axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject cvs commit: xml-axis/java/test/functional TestTCPTransportSample.java
Date Fri, 29 Jun 2001 18:43:31 GMT
gdaniels    01/06/29 11:43:30

  Modified:    java/samples/transport/tcp AdminClient.java TCPSender.java
                        TCPTransport.java
               java/src/org/apache/axis/client ServiceClient.java
               java/src/org/apache/axis/utils Admin.java
               java/test/functional TestTCPTransportSample.java
  Added:       java/samples/transport/tcp GetQuote.java Handler.java
                        deploy.xml
  Log:
  Fix TCP samples + functional tests.
  
  Despite Sam's foreboding, I'm putting in the beginnings of an architecture
  that lets us use custom URL StreamFactories for transport-specific URLs.
  ServiceClient currently has a (static) registry of protocols (Strings) to
  Transports.  If you want to use this, you need to set the system property
  java.protocol.handler.pkgs to an appopriate place.  Next step is to make
  sure we don't actually stomp the value of this property, just append to it.
  
  The AdminClient in samples.transport.tcp now works for http OR tcp,
  depending on the URL you pass in.
  
  Unbelievably, I can now actually run the functional tests to successful
  completion.  Yow!
  
  Revision  Changes    Path
  1.4       +4 -5      xml-axis/java/samples/transport/tcp/AdminClient.java
  
  Index: AdminClient.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/transport/tcp/AdminClient.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AdminClient.java	2001/06/27 16:18:10	1.3
  +++ AdminClient.java	2001/06/29 18:43:16	1.4
  @@ -61,8 +61,7 @@
   import java.net.URL;
   
   /**
  - * An admin client object, specific to TCP in that it sets
  - * the TCP transport up.
  + * An admin client object, which will work with the TCP transport.
    *
    * @author Rob Jellinghaus (robj@unrealities.com)
    * @author Doug Davis (dug@us.ibm.com)
  @@ -72,9 +71,9 @@
   public class AdminClient extends org.apache.axis.client.AdminClient {
   
       public static void main(String args[]) {
  -        /** !!! This shouldn't be hardcoded....
  -         */
  -        ServiceClient.setDefaultTransport(new TCPTransport("localhost", "8080"));
  +      
  +        System.setProperty("java.protocol.handler.pkgs", "samples.transport");
  +        ServiceClient.setTransportForProtocol("tcp", new TCPTransport());
           
           try {
               org.apache.axis.client.AdminClient.main(args);
  
  
  
  1.2       +4 -166    xml-axis/java/samples/transport/tcp/TCPSender.java
  
  Index: TCPSender.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/transport/tcp/TCPSender.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TCPSender.java	2001/06/21 02:45:34	1.1
  +++ TCPSender.java	2001/06/29 18:43:17	1.2
  @@ -87,88 +87,15 @@
   
       targetURL = msgContext.getStrProp( MessageContext.TRANS_URL);
       try {
  -      // This is a totally random, temporary URL specification:
  -      // http://host:port/service-name ??????? hmmmmmm
  -      URL      tmpURL = new URL( targetURL );
  -      String   host   = tmpURL.getHost();
  -      int      port   = tmpURL.getPort();
  +      String   host   = msgContext.getStrProp(TCPTransport.HOST);
  +      int      port   = Integer.parseInt(msgContext.getStrProp(TCPTransport.PORT));
         byte[]   buf    = new byte[4097];
         int      rc     = 0 ;
   
         Socket             sock = null ;
   
  -      /* comment out SSL stuff for now
  -      
  -      if (tmpURL.getProtocol().equalsIgnoreCase("https")) {
  -        if ( (port = tmpURL.getPort()) == -1 ) port = 443;
  -        String tunnelHost = System.getProperty("https.proxyHost");
  -        String tunnelPortString = System.getProperty("https.proxyPort");
  -        String tunnelUsername = System.getProperty("https.proxyUsername");
  -        String tunnelPassword = System.getProperty("https.proxyPassword");
  -        try {
  -          Class SSLSocketFactoryClass =
  -            Class.forName("javax.net.ssl.SSLSocketFactory");
  -          Class SSLSocketClass = Class.forName("javax.net.ssl.SSLSocket");
  -          Method createSocketMethod =
  -            SSLSocketFactoryClass.getMethod("createSocket",
  -                                            new Class[] {String.class, Integer.TYPE});
  -          Method getDefaultMethod =
  -            SSLSocketFactoryClass.getMethod("getDefault", new Class[] {});
  -          Method startHandshakeMethod =
  -            SSLSocketClass.getMethod("startHandshake", new Class[] {});
  -          Object factory = getDefaultMethod.invoke(null, new Object[] {});
  -          Object sslSocket = null;
  -          if (tunnelHost == null || tunnelHost.equals("")) {
  -            // direct SSL connection
  -            sslSocket = createSocketMethod .invoke(factory,
  -                                 new Object[] {host, new Integer(port)});
  -          } else {
  -            // SSL tunnelling through proxy server
  -            Method createSocketMethod2 =
  -              SSLSocketFactoryClass.getMethod("createSocket",
  -                                              new Class[] {Socket.class, String.class,
Integer.TYPE, Boolean.TYPE});
  -            int tunnelPort = (tunnelPortString != null? (Integer.parseInt(tunnelPortString)
< 0? 443: Integer.parseInt(tunnelPortString)): 443);
  -            Object tunnel = createSocketMethod .invoke(factory,
  -                                 new Object[] {tunnelHost, new Integer(tunnelPort)});
  -            // The tunnel handshake method (condensed and made reflexive)
  -            OutputStream tunnelOutputStream = (OutputStream)SSLSocketClass.getMethod("getOutputStream",
new Class[] {}).invoke(tunnel, new Object[] {});
  -            PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(tunnelOutputStream)));
  -            out.print("CONNECT " + host + ":" + port + " HTTP/1.0\n\r\n\r");
  -            out.flush();
  -            InputStream tunnelInputStream = (InputStream)SSLSocketClass.getMethod("getInputStream",
new Class[] {}).invoke(tunnel, new Object[] {});
  -            //BufferedReader in = new BufferedReader(new InputStreamReader(tunnelInputStream));
  -            //DataInputStream in = new DataInputStream(tunnelInputStream);
  -            Debug.Print(1, "Is tunnelInputStream null? " + String.valueOf(tunnelInputStream
== null));
  -            String replyStr = ""; int i;
  -            while ((i = tunnelInputStream.read()) != '\n' && i != '\r' &&
i != -1) { replyStr += String.valueOf((char)i); Debug.Print(1, "got a character in reply,
so far: " + replyStr); }
  -            if (!replyStr.startsWith("HTTP/1.0 200") && !replyStr.startsWith("HTTP/1.1
200")) {
  -              throw new IOException("Unable to tunnel through " + tunnelHost + ":" + tunnelPort
+ ".  Proxy returns \"" + replyStr + "\"");
  -            }
  -            // End of condensed reflective tunnel handshake method
  -            sslSocket = createSocketMethod2.invoke(factory,
  -                                 new Object[] {tunnel, host, new Integer(port), new Boolean(true)});
  -            Debug.Print( 1, "Set up SSL tunnelling through " + tunnelHost + ":" +tunnelPort);
  -          }
  -          // must shake out hidden errors!
  -          startHandshakeMethod.invoke(sslSocket, new Object[] {});
  -          sock = (Socket)sslSocket;
  -        } catch (ClassNotFoundException cnfe) {
  -          Debug.Print( 1, "SSL feature disallowed: JSSE files not installed or present
in classpath");
  -          throw new AxisFault(cnfe);
  -        } catch (NumberFormatException nfe) {
  -          Debug.Print( 1, "Proxy port number, \"" + tunnelPortString + "\", incorrectly
formatted");
  -          throw new AxisFault(nfe);
  -        }
  -        Debug.Print( 1, "Created an SSL connection");
  -      } else {
  -       */
  -      
  -        sock    = new Socket( host, port );
  -        Debug.Print( 1, "Created an insecure HTTP connection");
  -      
  -      /*
  -      }
  -       */
  +      sock    = new Socket( host, port );
  +      Debug.Print( 1, "Created an insecure HTTP connection");
   
         reqEnv  = (String) msgContext.getRequestMessage().getAsString();
         
  @@ -177,48 +104,6 @@
         BufferedInputStream inp = new BufferedInputStream(sock.getInputStream());
         OutputStream  out  = sock.getOutputStream();
         
  -      /*
  -      StringBuffer  otherHeaders = new StringBuffer();
  -      String        userID = null ;
  -      String        passwd = null ;
  -
  -      userID = msgContext.getStrProp( MessageContext.USERID );
  -      passwd = msgContext.getStrProp( MessageContext.PASSWORD );
  -
  -      if ( userID != null ) {
  -        StringBuffer tmpBuf = new StringBuffer();
  -        tmpBuf.append( userID )
  -              .append( ":" )
  -              .append( (passwd == null) ? "" : passwd) ;
  -        otherHeaders.append( HTTPConstants.HEADER_AUTHORIZATION )
  -                    .append( ": Basic " )
  -                    .append( Base64.encode( tmpBuf.toString().getBytes() ) )
  -                    .append("\n" );
  -      }
  -     
  -      StringBuffer header = new StringBuffer();
  -
  -      header.append( HTTPConstants.HEADER_POST )
  -            .append(" " )
  -            .append( ((tmpURL.getFile() == null ||
  -                       tmpURL.getFile().equals(""))? "/": tmpURL.getFile()) )
  -            .append( " HTTP/1.0\r\n" )
  -            .append( HTTPConstants.HEADER_CONTENT_LENGTH )
  -            .append( ": " )
  -            .append(reqEnv.length() )
  -            .append( "\r\n" )
  -            .append( HTTPConstants.HEADER_CONTENT_TYPE )
  -            .append( ": text/xml\r\n" )
  -            .append( (otherHeaders == null ? "" : otherHeaders.toString()) )
  -            .append( HTTPConstants.HEADER_SOAP_ACTION )
  -            .append( ": \"" )
  -            .append( action )
  -            .append( "\"\r\n\r\n" );
  -
  -      out.write( header.toString().getBytes() );
  -      
  -       */
  -      
         byte[] bytes = reqEnv.getBytes();
         String length = "" + bytes.length + "\r\n";
         out.write(length.getBytes());
  @@ -229,53 +114,6 @@
         Debug.Print( 1, "---------------------------------------------------");
         Debug.Print( 1, reqEnv );
   
  -      /*
  -      byte       lastB=0, b ;
  -      int        len = 0 ;
  -      int        colonIndex = -1 ;
  -      Hashtable  headers = new Hashtable();
  -      String     name, value ;
  -
  -      // Need to add logic for getting the version # and the return code
  -      // but that's for tomorrow!
  -
  -      for ( ;; ) {
  -        if ( (b = (byte) inp.read()) == -1 ) break ;
  -        if ( b != '\r' && b != '\n' ) {
  -          if ( b == ':' ) colonIndex = len ;
  -          lastB = (buf[len++] = b);
  -        }
  -        else if ( b == '\r' )
  -          continue ;
  -        else {
  -          if ( len == 0 ) break ;
  -          if ( colonIndex != -1 ) {
  -            name = new String( buf, 0, colonIndex );
  -            value = new String( buf, colonIndex+1, len-1-colonIndex );
  -          }
  -          else {
  -            name = new String( buf, 0, len );
  -            value = "" ;
  -          }
  -          Debug.Print( 1, name + value );
  -          if ( msgContext.getProperty(HTTPConstants.MC_HTTP_STATUS_CODE)==null){
  -            // Reader status code
  -            int start = name.indexOf( ' ' ) + 1 ;
  -            String tmp = name.substring(start).trim();
  -            int end   = tmp.indexOf( ' ' );
  -            if ( end != -1 ) tmp = tmp.substring( 0, end );
  -            rc = Integer.parseInt( tmp );
  -            msgContext.setProperty( HTTPConstants.MC_HTTP_STATUS_CODE,
  -                                    new Integer(rc) );
  -            msgContext.setProperty( HTTPConstants.MC_HTTP_STATUS_MESSAGE,
  -                                    name.substring(end+1));
  -          }
  -          else
  -            headers.put( name.toLowerCase(), value );
  -          len = 0 ;
  -        }
  -      }
  -       */
         if ( Debug.getDebugLevel() > 8 ) {
           // Special case - if the debug level is this high then something
           // really bad must be going on - so just dump the input stream
  
  
  
  1.4       +20 -2     xml-axis/java/samples/transport/tcp/TCPTransport.java
  
  Index: TCPTransport.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/transport/tcp/TCPTransport.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TCPTransport.java	2001/06/27 16:18:11	1.3
  +++ TCPTransport.java	2001/06/29 18:43:17	1.4
  @@ -55,6 +55,7 @@
   
   package samples.transport.tcp;
   
  +import java.net.URL;
   import java.util.* ;
   import org.apache.axis.* ;
   import org.apache.axis.utils.Debug ;
  @@ -99,15 +100,32 @@
       {
           mc.setTransportName("tcp");
           
  +        try {
  +          String urlString = mc.getStrProp(MessageContext.TRANS_URL);
  +          if (urlString != null) {
  +            URL url = new URL(urlString);
  +            mc.setProperty(HOST, url.getHost());
  +            mc.setProperty(PORT, new Integer(url.getPort()).toString());
  +          }
  +        } catch (java.net.MalformedURLException e) {
  +          // Do nothing here?
  +        }
  +
  +        if (host != null) serv.set(HOST, host);
  +        if (port != null) serv.set(PORT, port);
  +
  +        Debug.Print(3, "Port = " + mc.getStrProp(PORT));
  +        Debug.Print(3, "Host = " + mc.getStrProp(HOST));
  +        
           // kind of ugly... fake up a "http://host:port/" url to send down the chain
           // ROBJ TODO: clean this up so we use TCP transport properties all the way down
           // use serviceclient properties if any, otherwise use ours
  -        if (host != null) serv.set(HOST, host);
  -        if (port != null) serv.set(PORT, port);
  +        /*
           String url = "http://"+serv.get(HOST)+":"+serv.get(PORT);
           
           Debug.Print(4, "TCPTransport set URL to '" + url + "'");
           mc.setProperty(MessageContext.TRANS_URL, url);
  +        */
       }
   }
   
  
  
  
  1.1                  xml-axis/java/samples/transport/tcp/GetQuote.java
  
  Index: GetQuote.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package samples.transport.tcp ;
  
  import java.net.*;
  import java.io.*;
  import java.util.*;
  
  import org.apache.axis.AxisFault ;
  import org.apache.axis.client.ServiceClient ;
  import org.apache.axis.client.Transport ;
  import org.apache.axis.transport.http.HTTPConstants;
  import org.apache.axis.message.RPCParam ;
  import org.apache.axis.utils.Debug ;
  import org.apache.axis.utils.Options ;
  import org.apache.axis.utils.QName ;
  import org.apache.axis.encoding.ServiceDescription;
  import org.apache.axis.encoding.SOAPTypeMappingRegistry;
  
  /**
   *
   * @author Doug Davis (dug@us.ibm.com.com)
   */
  public class GetQuote {
      public  String symbol ;
      
    // helper function; does all the real work
      public float getQuote (String args[]) throws Exception {
          System.setProperty("java.protocol.handler.pkgs", "samples.transport");
  
          Options opts = new Options( args );
  
        Debug.setDebugLevel( opts.isFlagSet( 'd' ) );
  
        args = opts.getRemainingArgs();
  
        if ( args == null ) {
          System.err.println( "Usage: GetQuote <symbol>" );
          System.exit(1);
        }
  
        String namespace = "urn:xmltoday-delayed-quotes";
        symbol = args[0] ;
  
        ServiceClient call = new ServiceClient(opts.getURL());
        call.setTransport(new TCPTransport());
        ServiceDescription sd = new ServiceDescription("stockQuotes", true);
        sd.addInputParam("symbol", SOAPTypeMappingRegistry.XSD_STRING);
        sd.setOutputParam(SOAPTypeMappingRegistry.XSD_FLOAT);
        call.setServiceDescription(sd);
        
        // TESTING HACK BY ROBJ
        if (symbol.equals("XXX_noaction")) {
            symbol = "XXX";
            call.set(HTTPConstants.MC_HTTP_SOAPACTION, "");
        }
  
        if ( opts.isFlagSet('t') > 0 ) call.doLocal = true ;
  
        call.set( Transport.USER, opts.getUser() );
        call.set( Transport.PASSWORD, opts.getPassword() );
  
        // useful option for profiling - perhaps we should remove before
        // shipping?
        String countOption = opts.isValueSet('c');
        int count=1;
        if ( countOption != null) {
          count=Integer.valueOf(countOption).intValue();
          System.out.println("Iterating " + count + " times");
        }
  
        Float res = new Float(0.0F);
        for (int i=0; i<count; i++) {
            Object ret = call.invoke(
            namespace, "getQuote", new Object[] {symbol} );
            if (ret instanceof String) {
                System.out.println("Received problem response from server: "+ret);
                throw new AxisFault("", (String)ret, null, null);
            }
          res = (Float) ret;
        }
  
          return res.floatValue();
      }
  
    public static void main(String args[]) {
      try {
          GetQuote gq = new GetQuote();
          float val = gq.getQuote(args);
          // args array gets side-effected
          System.out.println(gq.symbol + ": " + val);
      }
      catch( Exception e ) {
          if ( e instanceof AxisFault ) {
              ((AxisFault)e).dump();
          } else
              e.printStackTrace();
      }
    }
    
    public GetQuote () {
    };
  
  };
  
  
  
  1.1                  xml-axis/java/samples/transport/tcp/Handler.java
  
  Index: Handler.java
  ===================================================================
  package samples.transport.tcp;
  
  import java.net.*;
  
  public class Handler extends URLStreamHandler
  {
    protected URLConnection openConnection(URL u)
    {
      return null;
    }
  }
  
  
  
  1.1                  xml-axis/java/samples/transport/tcp/deploy.xml
  
  Index: deploy.xml
  ===================================================================
  <m:deploy xmlns:m="AdminService">
   <handler name="TCPSender" class="samples.transport.tcp.TCPSender"/>
   <transport name="tcp" pivot="TCPSender"/>
  </m:deploy>
  
  
  
  1.23      +7 -4      xml-axis/java/src/org/apache/axis/client/ServiceClient.java
  
  Index: ServiceClient.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/ServiceClient.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- ServiceClient.java	2001/06/27 16:18:27	1.22
  +++ ServiceClient.java	2001/06/29 18:43:22	1.23
  @@ -93,6 +93,7 @@
   public class ServiceClient {
       // Client transports
       private static Transport defaultTransport = null;
  +    private static Hashtable transports = new Hashtable();
                                                           
       // keep prop hashtable small
       private Hashtable properties = new Hashtable(10);
  @@ -161,15 +162,17 @@
           defaultTransport = transport;
       }
       
  +    public static void setTransportForProtocol(String protocol, Transport transport)
  +    {
  +        transports.put(protocol, transport);
  +    }
  +    
       public Transport getTransportForProtocol(String protocol)
       {
  -      if (defaultTransport != null)
  -        return defaultTransport;
  -      
         if (protocol.equals("http"))
           return new HTTPTransport();
         
  -      return null;
  +      return (Transport)transports.get(protocol);
       }
       
       /**
  
  
  
  1.50      +1 -1      xml-axis/java/src/org/apache/axis/utils/Admin.java
  
  Index: Admin.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/Admin.java,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- Admin.java	2001/06/29 13:14:40	1.49
  +++ Admin.java	2001/06/29 18:43:24	1.50
  @@ -431,7 +431,7 @@
         if ((request == null) &&
             (response == null) &&
             (pivot == null))
  -        throw new AxisFault("No request/response/pivot for chain!");
  +        throw new AxisFault("No request/response/pivot for chain '" + name + "'!");
         
         StringTokenizer      st = null ;
         Vector reqNames = new Vector();
  
  
  
  1.3       +12 -12    xml-axis/java/test/functional/TestTCPTransportSample.java
  
  Index: TestTCPTransportSample.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/functional/TestTCPTransportSample.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestTCPTransportSample.java	2001/06/26 21:01:09	1.2
  +++ TestTCPTransportSample.java	2001/06/29 18:43:29	1.3
  @@ -61,7 +61,7 @@
   
   import org.apache.axis.AxisFault ;
   import samples.transport.tcp.TCPTransport;
  -import org.apache.axis.client.AdminClient;
  +import samples.transport.tcp.AdminClient;
   import org.apache.axis.utils.Admin;
   import org.apache.axis.client.ServiceClient;
   import org.apache.axis.encoding.ServiceDescription;
  @@ -96,18 +96,9 @@
           try {
               System.out.println("Testing TCP stock service...");
               String   symbol = "XXX"; // args[0] ;
  -            URL url = null;
  -            // parse host, port out of URL by hand
  -            // what to do about that URL format issue.....
  -            try {
  -                url = new URL("http://localhost:8088"); // (opts.getURL());
  -            } catch (IOException ex) {
  -                System.err.println("URL "+url+" hosed: "+ex);
  -                System.exit(1);
  -            }
  -            
  +
               ServiceClient call   = new ServiceClient
  -                ( new TCPTransport(url.getHost(), ""+url.getPort()) );
  +                ( new TCPTransport("localhost", "8088") );
               
               // reconstruct URL
               ServiceDescription sd = new ServiceDescription("stockQuotes", true);
  @@ -163,6 +154,15 @@
               e.printStackTrace();
               throw new Exception("Fault returned from test: "+e);
           }
  +    }
  +    
  +    public static void main(String [] args)
  +    {
  +      TestTCPTransportSample tester = new TestTCPTransportSample("TCP test");
  +      try {
  +        tester.testTCPTransportSample();
  +      } catch (Exception e) {
  +      }
       }
       
   }
  
  
  

Mime
View raw message