antelder 2002/12/10 03:03:26
Added: java/samples/simplesoap README.html StockquoteSOAP.wsdl
java/samples/simplesoap/client/stub Run.java README.html
java/samples/complexsoap Zip2Geo.wsdl README.html
java/samples/complexsoap/client/dynamic Run.java README.html
java/samples/simplesoap/client/stub/com/themindelectric/www
NetXmethodsServicesStockquoteStockQuotePortType.java
java/samples/complexsoap/client/stub README.html Run.java
java/samples/complexsoap/client/stub/com/cdyne/ws
LatLongReturn.java Zip2GeoSoap.java
java/samples/simplesoap/client/dynamic README.html
Removed: java/samples/SimpleSOAP/client/stub README.html Run.java
java/samples/ComplexSOAP/client/stub/com/cdyne/ws
LatLongReturn.java Zip2GeoSoap.java
java/samples/SimpleSOAP StockquoteSOAP.wsdl README.html
java/samples/ComplexSOAP/client/dynamic README.html Run.java
java/samples/ComplexSOAP Zip2Geo.wsdl README.html
java/samples/SimpleSOAP/client/stub/com/themindelectric/www
NetXmethodsServicesStockquoteStockQuotePortType.java
java/samples/ComplexSOAP/client/stub README.html Run.java
java/samples/SimpleSOAP/client/dynamic README.html
Log:
Change package names to all lowercase and restructure so that we can continue having
just java/samples in the build class path
Revision Changes Path
1.1 xml-axis-wsif/java/samples/simplesoap/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">
<h1>
Web Services Invocation Framework:<br>
SimpleSOAP Sample</h1>
<p>This sample aims to demonstrate the invocation of the simple SOAP service, one
that has minimum functionality and uses only primitive schema types. We invoke the
ever-popular Stockquote service. For those unfamilar with it, this is a SOAP service
that offers one port type with a single operation. That operation takes as input a
stock symbol (that has schema type string) and returns a recent stock quote for that
company (the stockquote has schema type float). Most SOAP engines use this sample,
this one differs from the others in that you don't need to deploy the service at all;
instead we make use of the public Stockquote service developed and hosted by the good
folks at <a href="http://www.xmethods.net">XMethods</a>. The service URL, where you
can find details on the service implementation, etc. is <a
href="http://www.xmethods.net/ve2/ViewListing.po?serviceid=2">here</a>.</p>
<p>The <a href="StockquoteSOAP.wsdl">WSDL file</a> in this sample directory is
publicly available via the service URL and has been downloaded from there.</p>
<p><a href="client/dynamic/README.html">Here's</a> how to invoke this service
dynamically using WSIF's dynamic invocation interface (DII).</p>
<p><a href="client/stub/README.html">Here's</a> 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.</p>
<hr width="100%">
</body></html>
1.1 xml-axis-wsif/java/samples/simplesoap/StockquoteSOAP.wsdl
Index: StockquoteSOAP.wsdl
===================================================================
<?xml version='1.0' encoding='UTF-8'?>
<definitions name='net.xmethods.services.stockquote.StockQuote'
targetNamespace='http://www.themindelectric.com/wsdl/net.xmethods.services.stockquote.StockQuote/'
xmlns:tns='http://www.themindelectric.com/wsdl/net.xmethods.services.stockquote.StockQuote/'
xmlns:electric='http://www.themindelectric.com/'
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
xmlns='http://schemas.xmlsoap.org/wsdl/'>
<message name='getQuoteResponse1'>
<part name='Result' type='xsd:float'/>
</message>
<message name='getQuoteRequest1'>
<part name='symbol' type='xsd:string'/>
</message>
<portType name='net.xmethods.services.stockquote.StockQuotePortType'>
<operation name='getQuote' parameterOrder='symbol'>
<input message='tns:getQuoteRequest1'/>
<output message='tns:getQuoteResponse1'/>
</operation>
</portType>
<binding name='net.xmethods.services.stockquote.StockQuoteBinding'
type='tns:net.xmethods.services.stockquote.StockQuotePortType'>
<soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>
<operation name='getQuote'>
<soap:operation soapAction='urn:xmethods-delayed-quotes#getQuote'/>
<input>
<soap:body use='encoded'
namespace='urn:xmethods-delayed-quotes'
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</input>
<output>
<soap:body use='encoded'
namespace='urn:xmethods-delayed-quotes'
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</output>
</operation>
</binding>
<service name='net.xmethods.services.stockquote.StockQuoteService'>
<documentation>net.xmethods.services.stockquote.StockQuote web
service</documentation>
<port name='net.xmethods.services.stockquote.StockQuotePort'
binding='tns:net.xmethods.services.stockquote.StockQuoteBinding'>
<soap:address location='http://66.28.98.121:9090/soap'/>
</port>
</service>
</definitions>
1.1 xml-axis-wsif/java/samples/simplesoap/client/stub/Run.java
Index: Run.java
===================================================================
package simplesoap.client.stub;
import org.apache.wsif.WSIFService;
import org.apache.wsif.WSIFServiceFactory;
import org.apache.wsif.WSIFException;
import java.rmi.RemoteException;
import
simplesoap.client.stub.com.themindelectric.www.NetXmethodsServicesStockquoteStockQuotePortType;
/**
* 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 ([EMAIL PROTECTED])
*/
public class Run {
public static void main(String [] args) {
try {
if (args.length!=2) {
System.out.println("Usage: java samples.SimpleSOAP.client.stub.Run
<wsdl location> <company symbol>");
System.exit(1);
}
// create a service factory
WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
// parse WSDL
WSIFService service = factory.getService(args[0], null,
null,
"http://www.themindelectric.com/wsdl/net.xmethods.services.stockquote.StockQuote/",
"net.xmethods.services.stockquote.StockQuotePortType");
NetXmethodsServicesStockquoteStockQuotePortType stub = null;
// create the stub
stub = (NetXmethodsServicesStockquoteStockQuotePortType)
service.getStub(NetXmethodsServicesStockquoteStockQuotePortType.class);
// do the invocation
// args[1] is the company symbol
float quote = stub.getQuote(args[1]);
System.out.println(quote);
} 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.1 xml-axis-wsif/java/samples/simplesoap/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 SimpleSOAP 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 location of
the WSDL file for the sample and the symbol for the company whose stock quote you are
interested in. For example, <br>
<tt>java samples.SimpleSOAP.client.static.Run
file:/mywsifinstallation/samples/SimpleSOAP/StockquoteSOAP.wsdl IBM</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 ../../StockquoteSOAP.wsdl</tt><br>
After the tool finished running, we deleted all the generated files except
<tt>NetXmethodsServicesStockquoteStockQuotePortType.java</tt> (this is the java
interface corresponding to the port type and is all that is required by WSIF).</p>
<hr width="100%">
</body></html>
1.1 xml-axis-wsif/java/samples/complexsoap/Zip2Geo.wsdl
Index: Zip2Geo.wsdl
===================================================================
<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://ws.cdyne.com"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="http://ws.cdyne.com" xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<s:schema elementFormDefault="qualified" targetNamespace="http://ws.cdyne.com">
<s:element name="GetLatLong">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="zipcode" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="LicenseKey" type="s:string"
/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetLatLongResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="GetLatLongResult"
type="s0:LatLongReturn" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="LatLongReturn">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="ServiceError"
type="s:boolean" />
<s:element minOccurs="1" maxOccurs="1" name="AddressError"
type="s:boolean" />
<s:element minOccurs="0" maxOccurs="1" name="City" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="StateAbbrev" type="s:string"
/>
<s:element minOccurs="0" maxOccurs="1" name="ZipCode" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="County" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="FromLongitude"
type="s:decimal" />
<s:element minOccurs="1" maxOccurs="1" name="FromLatitude"
type="s:decimal" />
<s:element minOccurs="1" maxOccurs="1" name="ToLongitude" type="s:decimal"
/>
<s:element minOccurs="1" maxOccurs="1" name="ToLatitude" type="s:decimal"
/>
<s:element minOccurs="1" maxOccurs="1" name="AvgLongitude"
type="s:decimal" />
<s:element minOccurs="1" maxOccurs="1" name="AvgLatitude" type="s:decimal"
/>
<s:element minOccurs="0" maxOccurs="1" name="CMSA" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="PMSA" type="s:string" />
</s:sequence>
</s:complexType>
<s:element name="LatLongReturn" type="s0:LatLongReturn" />
</s:schema>
</types>
<message name="GetLatLongSoapIn">
<part name="parameters" element="s0:GetLatLong" />
</message>
<message name="GetLatLongSoapOut">
<part name="parameters" element="s0:GetLatLongResponse" />
</message>
<message name="GetLatLongHttpGetIn">
<part name="zipcode" type="s:string" />
<part name="LicenseKey" type="s:string" />
</message>
<message name="GetLatLongHttpGetOut">
<part name="Body" element="s0:LatLongReturn" />
</message>
<message name="GetLatLongHttpPostIn">
<part name="zipcode" type="s:string" />
<part name="LicenseKey" type="s:string" />
</message>
<message name="GetLatLongHttpPostOut">
<part name="Body" element="s0:LatLongReturn" />
</message>
<portType name="Zip2GeoSoap">
<operation name="GetLatLong">
<documentation>This method will convert a zip code to Longitude and Latitude.
You will get better accuracy with the plus 4 added to the zipcode. Use a license key
of 0 for testing.</documentation>
<input message="s0:GetLatLongSoapIn" />
<output message="s0:GetLatLongSoapOut" />
</operation>
</portType>
<portType name="Zip2GeoHttpGet">
<operation name="GetLatLong">
<documentation>This method will convert a zip code to Longitude and Latitude.
You will get better accuracy with the plus 4 added to the zipcode. Use a license key
of 0 for testing.</documentation>
<input message="s0:GetLatLongHttpGetIn" />
<output message="s0:GetLatLongHttpGetOut" />
</operation>
</portType>
<portType name="Zip2GeoHttpPost">
<operation name="GetLatLong">
<documentation>This method will convert a zip code to Longitude and Latitude.
You will get better accuracy with the plus 4 added to the zipcode. Use a license key
of 0 for testing.</documentation>
<input message="s0:GetLatLongHttpPostIn" />
<output message="s0:GetLatLongHttpPostOut" />
</operation>
</portType>
<binding name="Zip2GeoSoap" type="s0:Zip2GeoSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"
/>
<operation name="GetLatLong">
<soap:operation soapAction="http://ws.cdyne.com/GetLatLong" style="document"
/>
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<service name="Zip2Geo">
<port name="Zip2GeoSoap" binding="s0:Zip2GeoSoap">
<soap:address location="http://ws.cdyne.com/ziptogeo/zip2geo.asmx" />
</port>
</service>
</definitions>
1.1 xml-axis-wsif/java/samples/complexsoap/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">
<h1>
Web Services Invocation Framework:<br>
ComplexSOAP Sample</h1>
<p>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.</p>
<p>The particular service we have chosen to demonstrate how to WSIF for such
invocations is called <em>Zip2Geo</em>. This is a publicly available service hosted by
<a href="http://www.cdyne.com">www.cdyne.com</a>. The service offers a single port
type with one operation, called <tt>GetLatLong</tt>. 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 <a
href="http://www.xmethods.net/ve2/ViewListing.po?serviceid=175331">here</a>.</p>
<p>The <a href="Zip2Geo.wsdl">WSDL file</a> in this sample directory is publicly
available via the service URL and has been downloaded from there.</p>
<p><a href="client/dynamic/README.html">Here's</a> how to invoke this service
dynamically using WSIF's dynamic invocation interface (DII).</p>
<p><a href="client/stub/README.html">Here's</a> 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.</p>
<hr width="100%">
</body></html>
1.1 xml-axis-wsif/java/samples/complexsoap/client/dynamic/Run.java
Index: Run.java
===================================================================
package complexsoap.client.dynamic;
import javax.xml.namespace.QName;
import org.apache.wsif.WSIFMessage;
import org.apache.wsif.WSIFOperation;
import org.apache.wsif.WSIFPort;
import org.apache.wsif.WSIFService;
import org.apache.wsif.WSIFServiceFactory;
import complexsoap.client.stub.com.cdyne.ws.LatLongReturn;
public class Run {
public static void main(String [] args) throws Exception {
// args[0] is the zip code
if(args.length!=2) {
System.out.println("Usage: java samples.ComplexSOAP.client.dynamic.Run
<wsdl location> <zip code>");
System.exit(1);
}
// create a service factory
WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
WSIFService service = factory.getService(args[0], null,
null, "http://ws.cdyne.com",
"Zip2GeoSoap");
// map types
service.mapType(new QName("http://ws.cdyne.com","LatLongReturn"),
Class.forName("com.cdyne.ws.LatLongReturn"));
// get the port
WSIFPort port = service.getPort();
// create the operation
WSIFOperation operation = port.createOperation("GetLatLong");
// create the input, output and fault messages associated with this operation
WSIFMessage input = operation.createInputMessage();
WSIFMessage output = operation.createOutputMessage();
WSIFMessage fault = operation.createFaultMessage();
// populate the input message
input.setObjectPart("zipcode",args[1]);
input.setObjectPart("LicenseKey","");
// do the invocation
if (operation.executeRequestResponseOperation(input, output,
fault)) {
// invocation succeeded, extract information from output
// message
LatLongReturn zipInfo = (LatLongReturn)
output.getObjectPart("GetLatLongResult");
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());
} else {
System.out.println("Invocation failed");
// extract fault message info
}
}
}
1.1
xml-axis-wsif/java/samples/complexsoap/client/dynamic/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 SimpleSOAP Sample using WSIF's dynamic invocation 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,
commons-discovery.jar, jaxrpc.jar, saaj.jar</li>
</ul>
</p>
<p>After you have set up the CLASSPATH in your environment, to invoke this sample
using WSIF's DII, run the <tt>Run</tt> class located in this directory. Specify as
command line arguments the location of the WSDL file for the service and the zip code
you are interested in. For example, <br><tt>java
samples.ComplexSOAP.clients.dynamic.Run
file:/mywsifinstallation/samples/ComplexSOAP/Zip2Geo.wsdl 10005</tt></p>
<p>Look at the code in the <tt>Run.java</tt> file in this directory to see how to
use WSIF's DII yourself. Note that the <tt>DynamicInvoker</tt> class we used to <a
href="../../../SimpleSOAP/client/dynamic/README.html">invoke the SimpleSOAP sample
dynamically</a> cannot be used for this one since the <tt>DynamicInvoker</tt> as it
stands now is limited to invocation of services using primitive schema types only.</p>
<hr width="100%">
</body></html>
1.1
xml-axis-wsif/java/samples/simplesoap/client/stub/com/themindelectric/www/NetXmethodsServicesStockquoteStockQuotePortType.java
Index: NetXmethodsServicesStockquoteStockQuotePortType.java
===================================================================
/**
* NetXmethodsServicesStockquoteStockQuotePortType.java
*
* This file was auto-generated from WSDL
* by the Apache Axis WSDL2Java emitter.
*/
package simplesoap.client.stub.com.themindelectric.www;
public interface NetXmethodsServicesStockquoteStockQuotePortType extends
java.rmi.Remote {
public float getQuote(java.lang.String symbol) throws java.rmi.RemoteException;
}
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 location of
the WSDL file for the sample followed by the zip code of interest. For example, <br>
<tt>java file:/mywsifinstallation/samples/ComplexSOAP/Zip2Geo.wsdl
samples.ComplexSOAP.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 complexsoap.client.stub;
import org.apache.wsif.WSIFService;
import org.apache.wsif.WSIFServiceFactory;
import org.apache.wsif.WSIFException;
import java.rmi.RemoteException;
import complexsoap.client.stub.com.cdyne.ws.LatLongReturn;
import complexsoap.client.stub.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 ([EMAIL PROTECTED])
*/
public class Run {
public static void main(String [] args) {
try {
if (args.length!=2) {
System.out.println("Usage: java samples.ComplexSOAP.client.stub.Run
<wsdl location> <zip code>");
System.exit(1);
}
// create a service factory
WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
// parse WSDL
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[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 "+
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.1
xml-axis-wsif/java/samples/complexsoap/client/stub/com/cdyne/ws/LatLongReturn.java
Index: LatLongReturn.java
===================================================================
/**
* LatLongReturn.java
*
* This file was auto-generated from WSDL
* by the Apache Axis WSDL2Java emitter.
*/
package complexsoap.client.stub.com.cdyne.ws;
public class LatLongReturn implements java.io.Serializable {
private boolean serviceError;
private boolean addressError;
private java.lang.String city;
private java.lang.String stateAbbrev;
private java.lang.String zipCode;
private java.lang.String county;
private java.math.BigDecimal fromLongitude;
private java.math.BigDecimal fromLatitude;
private java.math.BigDecimal toLongitude;
private java.math.BigDecimal toLatitude;
private java.math.BigDecimal avgLongitude;
private java.math.BigDecimal avgLatitude;
private java.lang.String CMSA;
private java.lang.String PMSA;
public LatLongReturn() {
}
public boolean isServiceError() {
return serviceError;
}
public void setServiceError(boolean serviceError) {
this.serviceError = serviceError;
}
public boolean isAddressError() {
return addressError;
}
public void setAddressError(boolean addressError) {
this.addressError = addressError;
}
public java.lang.String getCity() {
return city;
}
public void setCity(java.lang.String city) {
this.city = city;
}
public java.lang.String getStateAbbrev() {
return stateAbbrev;
}
public void setStateAbbrev(java.lang.String stateAbbrev) {
this.stateAbbrev = stateAbbrev;
}
public java.lang.String getZipCode() {
return zipCode;
}
public void setZipCode(java.lang.String zipCode) {
this.zipCode = zipCode;
}
public java.lang.String getCounty() {
return county;
}
public void setCounty(java.lang.String county) {
this.county = county;
}
public java.math.BigDecimal getFromLongitude() {
return fromLongitude;
}
public void setFromLongitude(java.math.BigDecimal fromLongitude) {
this.fromLongitude = fromLongitude;
}
public java.math.BigDecimal getFromLatitude() {
return fromLatitude;
}
public void setFromLatitude(java.math.BigDecimal fromLatitude) {
this.fromLatitude = fromLatitude;
}
public java.math.BigDecimal getToLongitude() {
return toLongitude;
}
public void setToLongitude(java.math.BigDecimal toLongitude) {
this.toLongitude = toLongitude;
}
public java.math.BigDecimal getToLatitude() {
return toLatitude;
}
public void setToLatitude(java.math.BigDecimal toLatitude) {
this.toLatitude = toLatitude;
}
public java.math.BigDecimal getAvgLongitude() {
return avgLongitude;
}
public void setAvgLongitude(java.math.BigDecimal avgLongitude) {
this.avgLongitude = avgLongitude;
}
public java.math.BigDecimal getAvgLatitude() {
return avgLatitude;
}
public void setAvgLatitude(java.math.BigDecimal avgLatitude) {
this.avgLatitude = avgLatitude;
}
public java.lang.String getCMSA() {
return CMSA;
}
public void setCMSA(java.lang.String CMSA) {
this.CMSA = CMSA;
}
public java.lang.String getPMSA() {
return PMSA;
}
public void setPMSA(java.lang.String PMSA) {
this.PMSA = PMSA;
}
private java.lang.Object __equalsCalc = null;
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof LatLongReturn)) return false;
LatLongReturn other = (LatLongReturn) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = true &&
serviceError == other.isServiceError() &&
addressError == other.isAddressError() &&
((city==null && other.getCity()==null) ||
(city!=null &&
city.equals(other.getCity()))) &&
((stateAbbrev==null && other.getStateAbbrev()==null) ||
(stateAbbrev!=null &&
stateAbbrev.equals(other.getStateAbbrev()))) &&
((zipCode==null && other.getZipCode()==null) ||
(zipCode!=null &&
zipCode.equals(other.getZipCode()))) &&
((county==null && other.getCounty()==null) ||
(county!=null &&
county.equals(other.getCounty()))) &&
((fromLongitude==null && other.getFromLongitude()==null) ||
(fromLongitude!=null &&
fromLongitude.equals(other.getFromLongitude()))) &&
((fromLatitude==null && other.getFromLatitude()==null) ||
(fromLatitude!=null &&
fromLatitude.equals(other.getFromLatitude()))) &&
((toLongitude==null && other.getToLongitude()==null) ||
(toLongitude!=null &&
toLongitude.equals(other.getToLongitude()))) &&
((toLatitude==null && other.getToLatitude()==null) ||
(toLatitude!=null &&
toLatitude.equals(other.getToLatitude()))) &&
((avgLongitude==null && other.getAvgLongitude()==null) ||
(avgLongitude!=null &&
avgLongitude.equals(other.getAvgLongitude()))) &&
((avgLatitude==null && other.getAvgLatitude()==null) ||
(avgLatitude!=null &&
avgLatitude.equals(other.getAvgLatitude()))) &&
((CMSA==null && other.getCMSA()==null) ||
(CMSA!=null &&
CMSA.equals(other.getCMSA()))) &&
((PMSA==null && other.getPMSA()==null) ||
(PMSA!=null &&
PMSA.equals(other.getPMSA())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
_hashCode += new Boolean(isServiceError()).hashCode();
_hashCode += new Boolean(isAddressError()).hashCode();
if (getCity() != null) {
_hashCode += getCity().hashCode();
}
if (getStateAbbrev() != null) {
_hashCode += getStateAbbrev().hashCode();
}
if (getZipCode() != null) {
_hashCode += getZipCode().hashCode();
}
if (getCounty() != null) {
_hashCode += getCounty().hashCode();
}
if (getFromLongitude() != null) {
_hashCode += getFromLongitude().hashCode();
}
if (getFromLatitude() != null) {
_hashCode += getFromLatitude().hashCode();
}
if (getToLongitude() != null) {
_hashCode += getToLongitude().hashCode();
}
if (getToLatitude() != null) {
_hashCode += getToLatitude().hashCode();
}
if (getAvgLongitude() != null) {
_hashCode += getAvgLongitude().hashCode();
}
if (getAvgLatitude() != null) {
_hashCode += getAvgLatitude().hashCode();
}
if (getCMSA() != null) {
_hashCode += getCMSA().hashCode();
}
if (getPMSA() != null) {
_hashCode += getPMSA().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(LatLongReturn.class);
static {
org.apache.axis.description.FieldDesc field = new
org.apache.axis.description.ElementDesc();
field.setFieldName("serviceError");
field.setXmlName(new javax.xml.namespace.QName("http://ws.cdyne.com",
"ServiceError"));
field.setXmlType(new
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
typeDesc.addFieldDesc(field);
field = new org.apache.axis.description.ElementDesc();
field.setFieldName("addressError");
field.setXmlName(new javax.xml.namespace.QName("http://ws.cdyne.com",
"AddressError"));
field.setXmlType(new
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
typeDesc.addFieldDesc(field);
field = new org.apache.axis.description.ElementDesc();
field.setFieldName("city");
field.setXmlName(new javax.xml.namespace.QName("http://ws.cdyne.com",
"City"));
field.setXmlType(new
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
field.setMinOccursIs0(true);
typeDesc.addFieldDesc(field);
field = new org.apache.axis.description.ElementDesc();
field.setFieldName("stateAbbrev");
field.setXmlName(new javax.xml.namespace.QName("http://ws.cdyne.com",
"StateAbbrev"));
field.setXmlType(new
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
field.setMinOccursIs0(true);
typeDesc.addFieldDesc(field);
field = new org.apache.axis.description.ElementDesc();
field.setFieldName("zipCode");
field.setXmlName(new javax.xml.namespace.QName("http://ws.cdyne.com",
"ZipCode"));
field.setXmlType(new
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
field.setMinOccursIs0(true);
typeDesc.addFieldDesc(field);
field = new org.apache.axis.description.ElementDesc();
field.setFieldName("county");
field.setXmlName(new javax.xml.namespace.QName("http://ws.cdyne.com",
"County"));
field.setXmlType(new
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
field.setMinOccursIs0(true);
typeDesc.addFieldDesc(field);
field = new org.apache.axis.description.ElementDesc();
field.setFieldName("fromLongitude");
field.setXmlName(new javax.xml.namespace.QName("http://ws.cdyne.com",
"FromLongitude"));
field.setXmlType(new
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "decimal"));
typeDesc.addFieldDesc(field);
field = new org.apache.axis.description.ElementDesc();
field.setFieldName("fromLatitude");
field.setXmlName(new javax.xml.namespace.QName("http://ws.cdyne.com",
"FromLatitude"));
field.setXmlType(new
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "decimal"));
typeDesc.addFieldDesc(field);
field = new org.apache.axis.description.ElementDesc();
field.setFieldName("toLongitude");
field.setXmlName(new javax.xml.namespace.QName("http://ws.cdyne.com",
"ToLongitude"));
field.setXmlType(new
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "decimal"));
typeDesc.addFieldDesc(field);
field = new org.apache.axis.description.ElementDesc();
field.setFieldName("toLatitude");
field.setXmlName(new javax.xml.namespace.QName("http://ws.cdyne.com",
"ToLatitude"));
field.setXmlType(new
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "decimal"));
typeDesc.addFieldDesc(field);
field = new org.apache.axis.description.ElementDesc();
field.setFieldName("avgLongitude");
field.setXmlName(new javax.xml.namespace.QName("http://ws.cdyne.com",
"AvgLongitude"));
field.setXmlType(new
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "decimal"));
typeDesc.addFieldDesc(field);
field = new org.apache.axis.description.ElementDesc();
field.setFieldName("avgLatitude");
field.setXmlName(new javax.xml.namespace.QName("http://ws.cdyne.com",
"AvgLatitude"));
field.setXmlType(new
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "decimal"));
typeDesc.addFieldDesc(field);
field = new org.apache.axis.description.ElementDesc();
field.setFieldName("CMSA");
field.setXmlName(new javax.xml.namespace.QName("http://ws.cdyne.com",
"CMSA"));
field.setXmlType(new
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
field.setMinOccursIs0(true);
typeDesc.addFieldDesc(field);
field = new org.apache.axis.description.ElementDesc();
field.setFieldName("PMSA");
field.setXmlName(new javax.xml.namespace.QName("http://ws.cdyne.com",
"PMSA"));
field.setXmlType(new
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
field.setMinOccursIs0(true);
typeDesc.addFieldDesc(field);
};
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}
1.1
xml-axis-wsif/java/samples/complexsoap/client/stub/com/cdyne/ws/Zip2GeoSoap.java
Index: Zip2GeoSoap.java
===================================================================
/**
* Zip2GeoSoap.java
*
* This file was auto-generated from WSDL
* by the Apache Axis WSDL2Java emitter.
*/
package complexsoap.client.stub.com.cdyne.ws;
public interface Zip2GeoSoap extends java.rmi.Remote {
/**
* This method will convert a zip code to Longitude and Latitude. You
* will get better accuracy with the plus 4 added to the zipcode. Use
* a license key of 0 for testing.
*/
public complexsoap.client.stub.com.cdyne.ws.LatLongReturn
GetLatLong(java.lang.String zipcode, java.lang.String licenseKey) throws
java.rmi.RemoteException;
}
1.1 xml-axis-wsif/java/samples/simplesoap/client/dynamic/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 SimpleSOAP Sample using WSIF's dynamic invocation 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,
commons-discovery.jar, jaxrpc.jar, saaj.jar</li>
</ul>
</p>
<p>After you have set up the CLASSPATH in your environment, to invoke this sample
using WSIF's DII, run the DynamicInvoker class. Specify as command line arguments the
location of the WSDL file for the stockquote sample followed by the operation you wish
to invoke and the symbol for the company whose stockquote you are interested in. For
example, <br><tt>java samples.clients.DynamicInvoker
file:/mywsifinstallation/samples/SimpleSOAP/StockquoteSOAP.wsdl getQuote IBM</tt></p>
<hr width="100%">
</body></html>