You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ru...@apache.org on 2001/07/06 03:18:13 UTC

cvs commit: xml-axis/java/test put.java

rubys       01/07/05 18:18:13

  Added:       java/test put.java
  Log:
  Commit a tool I have found useful for testing
  
  Revision  Changes    Path
  1.1                  xml-axis/java/test/put.java
  
  Index: put.java
  ===================================================================
  package test;
  
  import java.io.*;
  import org.apache.axis.*;
  import org.apache.axis.client.AxisClient;
  import org.apache.axis.transport.http.HTTPSender;
  import org.apache.axis.utils.*;
  
  /**
   * A convenient little test program which will send a message as is to
   * the server.  Useful for debugging interoperability problems or 
   * handling of ill-formed messages that are hard to reproduce programmatically.
   *
   * Accepts the standard options, followed by a list of files containing
   * the contents to be sent.
   */
  class put {
      static void main(String[] args) throws Exception {
          Options opts = new Options(args);
          Debug.setDebugLevel( opts.isFlagSet( 'd' ) );
          args = opts.getRemainingArgs();
    
          for (int i=0; i<args.length; i++) {
              AxisClient client = new AxisClient();
              MessageContext mc = new MessageContext(client);
              FileInputStream stream = new FileInputStream(new File(args[i]));
              mc.setRequestMessage(new Message(stream));
              mc.setProperty(MessageContext.TRANS_URL, opts.getURL());
      
              new HTTPSender().invoke(mc);
          
              System.out.println(mc.getResponseMessage().getAsString());
          }
      }
  }