FileDocCategorySizeDatePackage
TestClient.javaAPI DocApache Axis 1.42845Sat Apr 22 18:56:52 BST 2006samples.misc

TestClient

public class TestClient extends Object
author
Doug Davis (dug@us.ibm.com)
author
Glen Daniels (gdaniels@allaire.com)

Fields Summary
public static String
msg
Constructors Summary
Methods Summary
public static java.lang.StringdoTest(java.lang.String[] args, java.lang.String op)
Send a hardcoded message to the server, and print the response.

param
args the command line arguments (mainly for specifying URL)
param
op an optional service argument, which will be used for specifying the transport-level service


                                             
              
      Options      opts    = new Options( args );
      String       url     = opts.getURL();
      String       action  = "EchoService" ;
        
      if (op != null) action = op;

      args = opts.getRemainingArgs();
      if ( args != null ) action = args[0];

      InputStream   input   = new ByteArrayInputStream(msg.getBytes());
      Service       service = new Service();
      Call          call    = (Call) service.createCall();
      SOAPEnvelope  env     = new SOAPEnvelope(input);

      call.setTargetEndpointAddress( new URL(url) );
      if (action != null) {
          call.setUseSOAPAction( true );
          call.setSOAPActionURI( action );
      }

      System.out.println( "Request:\n" + msg );

      env = call.invoke( env );

      System.out.println( "Response:\n" + env.toString() );
      return( env.toString() );
    
public static voidmain(java.lang.String[] args)

    doTest(args, null);
  
public static voidmainWithService(java.lang.String[] args, java.lang.String service)

    doTest(args, service);