axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nmu...@apache.org
Subject cvs commit: xml-axis-wsif/java/samples/ComplexSOAP/client/stub/com/cdyne/ws Zip2GeoSoap.java
Date Mon, 09 Dec 2002 18:15:20 GMT
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
  ===================================================================
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="Author" content="Nirmal Mukhi">
  <meta http-equiv="Content-Style-Type" content="text/css">
  <title>Web Services Invocation Framework: Samples</title>
  <link rel="stylesheet" href="wsif.css" type="text/css"></head>
  
  <body alink="#0000ff" bgcolor="#ffffff" leftmargin="2" topmargin="2" marginwidth="2"
marginheight="2">
  
  <h2>
  Web Services Invocation Framework:<br>
  Invoking the ComplexSOAP Sample through a high level stub interface</h2>
  <p>You must have the following on your classpath:
  <ul>
    <li>wsif.jar</li>
    <li>wsifsamples.jar</li>
    <li>A JAXP compliant XML parser, such as Xerces</li>
    <li>wsdl4j.jar</li>
    <li>qname.jar</li>
    <li>axis.jar (since by default WSIF uses its Axis provider to invoke SOAP services)</li>
    <li>JAR files required by Axis - log4j.jar, commons-logging.jar, jaxrpc.jar, saaj.jar</li>
  </ul>
  </p>
  <p>This directory contains a file called <tt>Run.java</tt> that contains
the <tt>main</tt> 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, <br>
  <tt>java samples.SimpleSOAP.client.static.Run 10005</tt></p>
  <p>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:<br>
  <tt>java org.apache.axis.wsdl.WSDL2Java ../../Zip2Geo.wsdl</tt><br>
  After the tool finished running, we deleted all the generated files except <tt>Zip2GeoSoap.java</tt>
and <tt>LatLongReturn.java</tt> (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.</p>
  <hr width="100%">
  </body></html>
  
  
  
  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 <zip code>");
  		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;
   }
  
  
  

Mime
View raw message