nmukhi      2002/12/06 13:17:22

  Added:       java/samples/SimpleSOAP README.html StockquoteSOAP.wsdl
               java/samples/SimpleSOAP/client/dynamic README.html
               java/samples/SimpleSOAP/client/stub README.html Run.java
               java/samples/SimpleSOAP/client/stub/com/themindelectric/www
                        NetXmethodsServicesStockquoteStockQuotePortType.java
  Log:
  Documentation, client code for simple stock quote sample using XMethods service
  (dir structure follows new sample format)
  
  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/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>Setting up the CLASSPATH for running the sample: 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>
  
  
  
  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>Setting up the CLASSPATH for running the sample: 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 yu can run this class, specifying on the command line the symbol for 
the company whose stock quote you are interested in. For example, <br>
  <tt>java samples.SimpleSOAP.client.static.Run 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 the one 
whose name ended with <tt>PortType</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/SimpleSOAP/client/stub/Run.java
  
  Index: Run.java
  ===================================================================
  package samples.SimpleSOAP.client.stub;
  
  import org.apache.wsif.WSIFService;
  import org.apache.wsif.WSIFServiceFactory;
  import org.apache.wsif.WSIFException;
  import java.rmi.RemoteException;
  import 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!=1) {
                System.out.println("Usage: java samples.SimpleSOAP.client.stub.Run 
<company symbol>");
                System.exit(1);
            }
            // create a service factory
            WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
            // parse WSDL
            WSIFService service = 
factory.getService("file:/work/xml-axis-wsif/java/samples/SimpleSOAP/StockquoteSOAP.wsdl",
 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[0] is the company symbol
            float quote = stub.getQuote(args[0]);
            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/com/themindelectric/www/NetXmethodsServicesStockquoteStockQuotePortType.java
  
  Index: NetXmethodsServicesStockquoteStockQuotePortType.java
  ===================================================================
  /**
   * NetXmethodsServicesStockquoteStockQuotePortType.java
   *
   * This file was auto-generated from WSDL
   * by the Apache Axis WSDL2Java emitter.
   */
  
  package com.themindelectric.www;
  
  public interface NetXmethodsServicesStockquoteStockQuotePortType extends 
java.rmi.Remote {
      public float getQuote(java.lang.String symbol) throws java.rmi.RemoteException;
  }
  
  
  


Reply via email to