The JavaTM Web Services Tutorial
Home
TOC
PREV TOP NEXT

Configuration File

The xrpcc tool reads an XML configuration file which specifies the files to be generated. The configuration file has two different formats, depending on whether you are starting with RMI interfaces or a WSDL document. The file can have one format or the other, but not both. The file's <configuration> element must have either one <rmi> element or one <wsdl> element.


Note: Although required for the reference implementation of JAX-RPC, the configuration file and xrpcc tool are not defined in the specifications. Their syntax and usage may change in future releases.

Starting With RMI Interfaces

If you are starting with RMI interfaces, the tool can generate stubs, ties, a server configuration file, and a WSDL document. In this case, the tool's configuration file must have the following form:

<?xml version="1.0" encoding="UTF-8"?> 	
 <configuration	
 xmlns="http://java.sun.com/jax-rpc-ri/xrpcc-config"> 	
   <rmi name="[1]" 	
        targetNamespace="[2]" 	
        typeNamespace="[3]"> 	
     <service name="[4]" 	
              packageName="[5]"> 	
         <interface name="[6]" 	
                    servantName="[7]" 	
                    soapAction="[8]" 	
                    soapActionBase="[9]"/> 	
     </service> 	
   <typeMappingRegistry> 	
     [10] 	
   </typeMappingRegistry> 	
   </rmi> 	
 </configuration>
 

The integers in the preceding syntax indicate the following:

  1. Model name
  2. Target namespace for the generated WSDL document
  3. Target namespace for the schema portion of the generated WSDL document
  4. Service name
  5. Package name for the generated classes (for example, the service interface that extends javax.xml.rpc.Service)
  6. Fully qualified name of an interface
  7. Fully qualified name of a servant class that implements the interface in [5]
  8. Optional - string to be used as the SOAPAction for all operations in the corresponding port
  9. Optional - string to be used as a prefix for the SOAPAction strings for the operations in the corresponding port
  10. Optional - type mapping information, see Specifying the Type Mapping

For RMI interfaces, the <configuration> element must have just one <rmi> element. The <rmi> element may contain multiple <service> elements, which may contain multiple <interface> elements.

SOAPAction Elements

If you are an advanced user you might be interested in the following information about SOAPAction elements: If the soapAction attribute is specified, all the operations in the generated port will use that string as the SOAPAction. If the soapActionBase attribute is specified, its value will be used as a prefix for the generated SOAPAction strings. The suffix will be a unique string; in the current implementation it is the operation name. For example, if soapActionBase is set to http://hello/ and the port has two operations, opA and opB, their SOAPAction strings will be http://hello/opA and http://hello/opB respectively. If neither soapAction nor soapActionBase are specified, the SOAPAction for all operations will be the empty string. Notice that this version of the reference implementation does not rely on the SOAPAction HTTP header for dispatching.

Starting With a WSDL Document

If you are starting with a WSDL document, the tool can generate stubs, ties, a server configuration file, and RMI interfaces. The tool's configuration file must have the following form:

<?xml version="1.0" encoding="UTF-8"?> 	
 <configuration	
 xmlns="http://java.sun.com/jax-rpc-ri/xrpcc-config"> 	
   <wsdl name="[1]" 	
         location="[2]" 	
         packageName="[3]"> 	
     <typeMappingRegistry> 	
       [4] 	
     </typeMappingRegistry> 	
   </wsdl> 	
 </configuration>
 

The integers in the preceding syntax indicate the following:

  1. Model name
  2. URL pointing to a WSDL document
  3. Fully qualified name of the package for the generated classes and interfaces
  4. Optional: type mapping information, see Specifying the Type Mapping

For WSDL documents, the <configuration> element must have just one <wsdl> element.

Server Configuration File

The xrpcc tool also generates a server configuration file for Tomcat. The name of the file is specified by the <init-param> element of the web.xml file. (The web.xml file is the deployment descriptor for a Web application that's packaged in a WAR file.) For example, the web.xml file might contain the following <init-param> element:

<init-param> 	
       <param-name>configuration.file</param-name> 	
       <param-value>/WEB-INF/config.properties</param-value> 	
     </init-param> 
 

Here's an example of a server configuration file that is generated by the xrpcc tool:

port0.tie=hello.HelloIF_Tie	
port0.servant=hello.HelloImpl	
port0.name=HelloIF	
port0.wsdl.targetNamespace=http://hello.org/wsdl	
port0.wsdl.serviceName=HelloWorld	
port0.wsdl.portName=HelloIFPort	
portcount=1
 

For the <init-param> example shown previously, the server configuration file should be copied to the WEB-INF/config.properties file in the Tomcat installation.

Specifying the Type Mapping

Intended for advanced users, this section describes the <typeMappingRegistry> element of the tool's configuration file. Here's an example:

<typeMappingRegistry> 	
   <typeMapping	
     encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 	
      <entry schemaType="ns1:SampleType" 	
         javaType="org.tempuri.WellKnownClass" 	
         serializerFactory=	
           "org.tempuri.WellKnownClassSerializationFactory" 	
          deserializerFactory=	
           "org.tempuri.WellKnownClassDeserializationFactory" 	
          xmlns:ns1="http://echoservice.org/types"/> 	
    </typeMapping> 	
 </typeMappingRegistry>
 

A type mapping registry can have multiple type mappings (for different encoding styles). Each mapping consists of multiple entries and all attributes on an entry are mandatory. For more information, see the JAX-RPC Specifications.

Home
TOC
PREV TOP NEXT