Return-Path:
This sample aims to demonstrate the invocation of a SOAP service that uses custom type definitions. This is a little different from using service that exchange messages typed using primitive schema types, since we have to have native equivalents for the custom schema types and know how to serialize and deserialize these the representations betwenour native format and the SOAP format. The particular service we have chosen to demonstrate how to WSIF for such invocations is called Zip2Geo. This is a publicly available services hosted by www.cdyne.com. The service offers a single port type with one operation, called GetLatLong. This operation takes as input a zip code, and returns as output information about the corresponding location, such as the name of the city, state, its latitude, longitude, etc. The return value is a complex schema type. The service URL, where you can find details on the service implementation, etc. is here. This sample aims to demonstrate the invocation of a SOAP service that uses custom type definitions. This is a little different from using service that exchange messages typed using primitive schema types, since we have to have native equivalents for the custom schema types and know how to serialize and deserialize these the representations between our native format and the SOAP format. The particular service we have chosen to demonstrate how to WSIF for such invocations is called Zip2Geo. This is a publicly available service hosted by www.cdyne.com. The service offers a single port type with one operation, called GetLatLong. This operation takes as input a zip code, and returns as output information about the corresponding location, such as the name of the city, state, its latitude, longitude, etc. The return value is a complex schema type. The service URL, where you can find details on the service implementation, etc. is here. The WSDL file in this sample directory is publicly available via the service URL and has been downloaded from there. Here's how to invoke this service dynamically using WSIF's dynamic invocation interface (DII). Here's how to invoke this service by first generating the stub interface and using this directly through WSIF's dynamic proxy, thus hiding all WSIF specifics from the client code. Note that the stub interface used is the the service interface as defined by the JAX-RPC specification.
Web Services Invocation Framework:
-
ComplexSOAP Sample
This directory contains a file called Run.java that contains the main method. This is the logic that uses the generated stub interface to run the sample. So you can run this class, specifying on the command line the zip code of interest. For example,
-java samples.SimpleSOAP.client.static.Run 10005
This directory contains a file called Run.java that contains the main method. This is the logic that uses the generated stub interface to run the sample. So you can run this class, specifying on the command line the location of the WSDL file for the sample followed by the zip code of interest. For example,
+java file:/mywsifinstallation/samples/ComplexSOAP/Zip2Geo.wsdl samples.ComplexSOAP.client.static.Run 10005
To generate the stub interface, you can use any tool that generates Java interfaces for WSDL services using their port type descriptions, such as WSDL2Java from Axis. WSIF assumes a correspondence between the generated Java interface and the WSDL port type that has its abstract description as specified in the JAX-RPC specification. This particular sample used WSDL2Java in the following way:
java org.apache.axis.wsdl.WSDL2Java ../../Zip2Geo.wsdl
After the tool finished running, we deleted all the generated files except Zip2GeoSoap.java and LatLongReturn.java (Zip2GeoSoap is the java interface corresponding to the port type; LatLongReturn is the java representation of the complex schema type returned by the service - that is all that is required by WSIF). Note that the WSIF provider (in this case, Axis) automatically handles (de)serialization of the data that the user's code sees.