Return-Path: Delivered-To: apmail-xml-axis-dev-archive@xml.apache.org Received: (qmail 77277 invoked by uid 500); 9 Dec 2002 21:46:34 -0000 Mailing-List: contact axis-dev-help@xml.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@xml.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-dev@xml.apache.org Received: (qmail 77268 invoked by uid 500); 9 Dec 2002 21:46:34 -0000 Delivered-To: apmail-xml-axis-wsif-cvs@apache.org Date: 9 Dec 2002 21:46:34 -0000 Message-ID: <20021209214634.4166.qmail@icarus.apache.org> From: nmukhi@apache.org To: xml-axis-wsif-cvs@apache.org Subject: cvs commit: xml-axis-wsif/java/samples/ComplexSOAP/client/stub README.html Run.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N nmukhi 2002/12/09 13:46:34 Modified: java/samples/ComplexSOAP README.html java/samples/ComplexSOAP/client/stub README.html Run.java Log: Completed writing and testing client Revision Changes Path 1.2 +2 -2 xml-axis-wsif/java/samples/ComplexSOAP/README.html Index: README.html =================================================================== RCS file: /home/cvs/xml-axis-wsif/java/samples/ComplexSOAP/README.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- README.html 9 Dec 2002 17:33:01 -0000 1.1 +++ README.html 9 Dec 2002 21:46:33 -0000 1.2 @@ -10,8 +10,8 @@

Web Services Invocation Framework:
ComplexSOAP Sample

-

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.

1.2 +2 -2 xml-axis-wsif/java/samples/ComplexSOAP/client/stub/README.html Index: README.html =================================================================== RCS file: /home/cvs/xml-axis-wsif/java/samples/ComplexSOAP/client/stub/README.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- README.html 9 Dec 2002 18:15:19 -0000 1.1 +++ README.html 9 Dec 2002 21:46:33 -0000 1.2 @@ -21,8 +21,8 @@
  • JAR files required by Axis - log4j.jar, commons-logging.jar, jaxrpc.jar, saaj.jar
  • -

    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.

    1.2 +5 -5 xml-axis-wsif/java/samples/ComplexSOAP/client/stub/Run.java Index: Run.java =================================================================== RCS file: /home/cvs/xml-axis-wsif/java/samples/ComplexSOAP/client/stub/Run.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Run.java 9 Dec 2002 18:15:19 -0000 1.1 +++ Run.java 9 Dec 2002 21:46:33 -0000 1.2 @@ -18,22 +18,22 @@ public class Run { public static void main(String [] args) { try { - if (args.length!=1) { - System.out.println("Usage: java samples.ComplexSOAP.client.stub.Run "); + if (args.length!=2) { + System.out.println("Usage: java samples.ComplexSOAP.client.stub.Run "); System.exit(1); } // create a service factory WSIFServiceFactory factory = WSIFServiceFactory.newInstance(); // parse WSDL - WSIFService service = factory.getService("file:/work/xml-axis-wsif/java/samples/ComplexSOAP/Zip2Geo.wsdl", null, + WSIFService service = factory.getService(args[0], null, null, "http://ws.cdyne.com", "Zip2GeoSoap"); Zip2GeoSoap stub = null; // create the stub stub = (Zip2GeoSoap) service.getStub(Zip2GeoSoap.class); // do the invocation - // args[0] is the zip code - LatLongReturn zipInfo = stub.GetLatLong(args[0],""); + // args[1] is the zip code + LatLongReturn zipInfo = stub.GetLatLong(args[1],""); System.out.println("This zip code is in "+zipInfo.getCity()+","+zipInfo.getStateAbbrev()+ " in "+zipInfo.getCounty()+" county\n"+ "It extends from longitude "+zipInfo.getFromLongitude()+" to longitude "+