Return-Path: Delivered-To: apmail-xml-axis-dev-archive@xml.apache.org Received: (qmail 99272 invoked by uid 500); 9 Dec 2002 18:15:20 -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 99263 invoked by uid 500); 9 Dec 2002 18:15:20 -0000 Delivered-To: apmail-xml-axis-wsif-cvs@apache.org Date: 9 Dec 2002 18:15:20 -0000 Message-ID: <20021209181520.31026.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/com/cdyne/ws Zip2GeoSoap.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N nmukhi 2002/12/09 10:15:19 Modified: java/samples/ComplexSOAP/client/stub/com/cdyne/ws Zip2GeoSoap.java Added: java/samples/ComplexSOAP/client/stub README.html Run.java Log: Revision Changes Path 1.1 xml-axis-wsif/java/samples/ComplexSOAP/client/stub/README.html Index: README.html =================================================================== Web Services Invocation Framework: Samples

Web Services Invocation Framework:
Invoking the ComplexSOAP Sample through a high level stub interface

You must have the following on your classpath:

  • wsif.jar
  • wsifsamples.jar
  • A JAXP compliant XML parser, such as Xerces
  • wsdl4j.jar
  • qname.jar
  • axis.jar (since by default WSIF uses its Axis provider to invoke SOAP services)
  • 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

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.1 xml-axis-wsif/java/samples/ComplexSOAP/client/stub/Run.java Index: Run.java =================================================================== package samples.ComplexSOAP.client.stub; import org.apache.wsif.WSIFService; import org.apache.wsif.WSIFServiceFactory; import org.apache.wsif.WSIFException; import java.rmi.RemoteException; import com.cdyne.ws.LatLongReturn; import com.cdyne.ws.Zip2GeoSoap; /** * Simple class that Runs the SimpleSOAP sample using a pregenerated stub interface * To use this class, provide a company stock symbol on the command line. WSIF * should then invoke the SOAP service with this information, returning with a recent * stockquote. * @author Nirmal K. Mukhi (nmukhi@us.ibm.com) */ public class Run { public static void main(String [] args) { try { if (args.length!=1) { 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, 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],""); 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 "+ zipInfo.getToLongitude()+"\n and from latitude "+zipInfo.getFromLatitude()+ " to latitude "+zipInfo.getToLatitude()); } catch (WSIFException we) { System.out.println("Error while executing sample, received an exception from WSIF; details:"); we.printStackTrace(); } catch (RemoteException re) { System.out.println("Error while executing sample, received an exception due to remote invocation; details:"); re.printStackTrace(); } } } 1.2 +1 -1 xml-axis-wsif/java/samples/ComplexSOAP/client/stub/com/cdyne/ws/Zip2GeoSoap.java Index: Zip2GeoSoap.java =================================================================== RCS file: /home/cvs/xml-axis-wsif/java/samples/ComplexSOAP/client/stub/com/cdyne/ws/Zip2GeoSoap.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Zip2GeoSoap.java 9 Dec 2002 17:32:23 -0000 1.1 +++ Zip2GeoSoap.java 9 Dec 2002 18:15:19 -0000 1.2 @@ -14,5 +14,5 @@ * will get better accuracy with the plus 4 added to the zipcode. Use * a license key of 0 for testing. */ - public com.cdyne.ws.LatLongReturn getLatLong(java.lang.String zipcode, java.lang.String licenseKey) throws java.rmi.RemoteException; + public com.cdyne.ws.LatLongReturn GetLatLong(java.lang.String zipcode, java.lang.String licenseKey) throws java.rmi.RemoteException; }