The xrpcc Tool

printer-friendly version of this section  Print  e-mail this section  E-Mail  add a public, group or private note  Add Note  add a bookmark about this section  Add Bookmark    

Java APIs for XML Kick Start
By Aoyon Chowdhury, Parag Choudhary

Table of Contents
Chapter 11.  Working with JAX-RPC


The xrpcc tool creates the following for you:

  • The stubs and ties.

  • A server configuration file. This file is not part of the JAX-RPC specification as such, but it is used by the Tomcat Web server.

  • If the Web service is a JAX-RPC implementation, the xrpcc tool generates the WSDL document describing the Web service from the RMI interface.

  • If the Web service is not a JAX-RPC implementation, you can use the xrpcc tool to generate the RMI interfaces that your JAX-RPC client can use to connect to the Web service. The xrpcc tool will use the WSDL file to generate the RMI interfaces.

To generate these files, the xrpcc tool reads a configuration XML file called config.xml. Depending on whether you start with the RMI interface or the WSDL document, the config.xml file will differ. Let's look at both of the syntaxes. Later on in the chapter, you will see an actual implementation of the config.xml file for the sample CarPartRequest Web service that you will create.

The config.xml File Syntax When Starting with RMI Interfaces

When starting with RMI interfaces, the config.xml file should have the following syntax:

<?xml version="1.0" encoding="UTF-8"?> <configuration xmlns="http://java.sun.com/jax-rpc-ri/xrpcc-config">   <service name="Name of the service"          packageName="Package name that stores the web service classes"          targetNamespace="Target namespace of the generated WSDL document"          typeNameSpace="Target namespace for the schema portion of the generated WSDL  graphics/ccc.gifdocument"     <interface name="name of the service endpoint interface"           servantName="Implementation class for the endpoint interface"           soapAction="(Optional)String to be used as the SOAP action for all operations  graphics/ccc.gifin the corresponding port"           soapActionBase="(Optional) Prefix for SOAPAction string">      <handlerChains>      </handlerChains> </interface> <typeMappingRegistry> User defined type mapping of Java to WSDL </typeMappingRegistry>      <handlerChains>      </handlerChains>      <namespaceMappingRegistry>      </namespaceMappingRegistry> </service> </configuration> 

After the mandatory XML declaration and namespace definition line, the configuration file begins with the service element. This element defines the name of the Web service and the package name. The name parameter takes the service name. This information is used when generating the WSDL document for the Web service. The value of the name parameter is used as the name of the WSDL document. It is also used as the value of the name parameter of the definitions element of the WSDL document. The targetNamespace and typeNamespace parameters define where the generated WSDL file and its schema definition will be hosted. The interface element describes the interfaces exposed by the Web service and the implementation class of the interface.

The config.xml file can have only one service element. However, depending on the number of Web services and the interfaces exposed by each of the Web services, there can be multiple interface elements.

The typeMappingRegistry element provides the mechanism to define your own type mappings between XML schema types and Java types. This is an optional entry.

The config.xml File Syntax When Starting with a WSDL Document

When starting with a WSDL document, the config.xml file should have the following syntax:

<?xml version="1.0" encoding="UTF-8"?> <configuration xmlns="http://java.sun.com/jax-rpc-ri/xrpcc-config"> <wsdl       location="URL to the WSDL document"       packageName="Name of the package for the generated interfaces and implementation  graphics/ccc.gifclasses"> <typeMappingRegistry> WSDL to Java type mapping information </typeMappingRegistry> <handlerChains> </handlerChains> <namespaceMappingRegistry> </namespaceMappingRegistry> </wsdl> </configuration> 

The wsdl element defines the URL address to the WSDL document, and the package name in which the generated stubs, ties, and RMI interfaces will be created when the xrpcc tool is run.

The optional element typeMappingRegistry enables you to define your own type mappings between XML schema data types and Java types.


printer-friendly version of this section  Print  e-mail this section  E-Mail  add a public, group or private note  Add Note  add a bookmark about this section  Add Bookmark    
Top

[0672324342/ch11lev1sec5]

 
 


JavaT APIs for XML Kick Start
JAX: Java APIs for XML Kick Start
ISBN: 0672324342
EAN: 2147483647
Year: 2002
Pages: 133

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net