Package org.apache.axis.utils

Examples of org.apache.axis.utils.Options


    * suggest getFlagFrequency and getArgValue or something.
    */
    public void testIsFlagSet() throws MalformedURLException
    {
        String[] fake_args = { "-w tiger" };
        Options ops = new Options(fake_args);
        String result = ops.isValueSet('w');
        assertEquals("tiger", result);
    }  
View Full Code Here


public class Client
{
    public static void main(String [] args)
    {
        try {
            Options options = new Options(args);
           
            String endpointURL = options.getURL();
            String textToSend;
           
            args = options.getRemainingArgs();
            if ((args == null) || (args.length < 1)) {
                textToSend = "<nothing>";
            } else {
                textToSend = args[0];
            }
View Full Code Here

   
  // helper function; does all the real work
    public float getQuote (String args[]) throws Exception {
      ServiceClient.addTransportPackage("samples.transport");

      Options opts = new Options( args );

      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.setOutputType(SOAPTypeMappingRegistry.XSD_FLOAT);
      call.setServiceDescription(sd);
     
      // TESTING HACK BY ROBJ
      if (symbol.equals("XXX_noaction")) {
          symbol = "XXX";
          call.set(HTTPConstants.MC_HTTP_SOAPACTION, "");
      }

      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");
      }
View Full Code Here

public class GetQuote {
    public  String symbol ;
   
  // helper function; does all the real work
    public float getQuote (String args[]) throws Exception {
      Options opts = new Options( args );

      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());
      ServiceDescription sd = new ServiceDescription("stockQuotes", true);
      sd.addInputParam("symbol", SOAPTypeMappingRegistry.XSD_STRING);
      sd.setOutputType(SOAPTypeMappingRegistry.XSD_FLOAT);
      call.setServiceDescription(sd);
     
      // TESTING HACK BY ROBJ
      if (symbol.equals("XXX_noaction")) {
          symbol = "XXX";
          call.set(HTTPConstants.MC_HTTP_SOAPACTION, "");
      }

      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");
      }
View Full Code Here

*/
public class GetInfo {

  public static void main(String args[]) {
    try {
      Options opts = new Options( args );

      args = opts.getRemainingArgs();

      if ( args == null || args.length % 2 != 0 ) {
        System.err.println( "Usage: GetInfo <symbol> <datatype>" );
        System.exit(1);
      }

      String  symbol = args[0] ;
      ServiceClient call = new ServiceClient
            (new HTTPTransport(opts.getURL(), "urn:cominfo"));

      call.set( Transport.USER, opts.getUser() );
      call.set( Transport.PASSWORD, opts.getPassword() );
      String res = (String) call.invoke(
        "urn:cominfo", "getInfo",
        new Object[] { args[0], args[1] } );
     
      System.out.println( symbol + ": " + res );
View Full Code Here

     *
     * Arguments are of the form:
     *   -h localhost -p 8080 -s /soap/servlet/rpcrouter
     */
    public static void main(String args[]) throws Exception {
        Options opts = new Options(args);

        boolean testPerformance = opts.isFlagSet('k') > 0;

        // set up tests so that the results are sent to System.out
        TestClient client;

        if (testPerformance) {
            client = new TestClient() {
               public void verify(String method, Object sent, Object gotBack) {
               }
            };
        } else {
            client = new TestClient() {
            public void verify(String method, Object sent, Object gotBack) {
                if (this.equals(sent, gotBack)) {
                    System.out.println(method + "\t OK");
                } else {
                    System.out.println(method + "\t Fail: " + gotBack);
                    if (gotBack instanceof Exception)
                        if (!(gotBack instanceof AxisFault))
                            ((Exception)gotBack).printStackTrace();
                }
            }
        };
        }

        // set up the call object
        client.setURL(opts.getURL());

        // support for tests with non-compliant applications
        client.addMethodToAction = (opts.isFlagSet('m') > 0);

        String action = opts.isValueSet('a');
        if (action != null) client.soapAction = action;

        if (testPerformance) {
            long startTime = System.currentTimeMillis();
            for (int i = 0; i < 10; i++) {
View Full Code Here

     * Arguments are of the form:
     *   -h localhost -p 8080 -s /soap/servlet/rpcrouter
     */
    public static void main(String args[]) throws Exception {
        // set up the call object
        Options opts = new Options(args);
        call = new ServiceClient(opts.getURL());
        call.set(HTTPTransport.ACTION, "http://www.soapinterop.org/Bid");

        // register the PurchaseOrder class
        QName poqn = new QName("http://www.soapinterop.org/Bid",
                               "PurchaseOrder");
View Full Code Here

     */
    public String process (String[] args) throws Exception
    {
        StringBuffer sb = new StringBuffer();
       
        Options opts = new Options( args );
       
        if (opts.isFlagSet('d') > 0) {
            // Set log4j properties... !!!
        }
       
        args = opts.getRemainingArgs();
       
        if ( args == null ) {
            log( "Usage: AdminClient xml-files | list" );
            return null;
        }
       
        for ( int i = 0 ; i < args.length ; i++ )
        {
            InputStream input = null;
           
            if ( args[i].equals("list") ) {
                log( "Doing a list" );
                String str = "<m:list xmlns:m=\"AdminService\"/>" ;
                input = new ByteArrayInputStream( str.getBytes() );
            } else if (args[i].equals("quit")) {
                log("Doing a quit");
                String str = "<m:quit xmlns:m=\"AdminService\"/>";
                input = new ByteArrayInputStream(str.getBytes());
            } else if (args[i].equals("passwd")) {
                log("Changing admin password");
                if (args[i + 1] == null) {
                    log("Must specify a password!");
                    return null;
                }
                String str = "<m:passwd xmlns:m=\"AdminService\">";
                str += args[i + 1];
                str += "</m:passwd>";
                input = new ByteArrayInputStream(str.getBytes());
                i++;
            }
            else {
                log( "Processing file: " + args[i] );
                input = new FileInputStream( args[i] );
            }
           
            ServiceClient client = new ServiceClient(opts.getURL());
           
            /** Unfortunately, this is transport-specific.  However, no one
            * but the HTTP transport should pick this property up.
            */
            client.set(HTTPConstants.MC_HTTP_SOAPACTION, "AdminService");
           
            Message         inMsg      = new Message( input, true );
           
            client.setRequestMessage( inMsg );
           
            client.set( Transport.USER, opts.getUser() );
            client.set( Transport.PASSWORD, opts.getPassword() );

            String tName = opts.isValueSet( 't' );
            if ( tName != null && !tName.equals("") )
                client.setTransportName( tName );
           
            client.invoke();
           
View Full Code Here

     */
    public static void main(String args[]) {

        SimpleAxisServer sas = new SimpleAxisServer();

        Options opts = null;
        try {
            opts = new Options(args);
        } catch (MalformedURLException e) {
            log.error(Messages.getMessage("malformedURLException00"), e);
            return;
        }

        try {
            doThreads = (opts.isFlagSet('t') > 0);

            int port = opts.getPort();
            ServerSocket ss = null;
            // Try five times
            for (int i = 0; i < 5; i++) {
                try {
                    ss = new ServerSocket(port);
View Full Code Here

public class Client
{
    public static void main(String [] args)
    {
        try {
            Options options = new Options(args);
           
            String endpointURL = options.getURL();
            String textToSend;
           
            args = options.getRemainingArgs();
            if ((args == null) || (args.length < 1)) {
                textToSend = "<nothing>";
            } else {
                textToSend = args[0];
            }
View Full Code Here

TOP

Related Classes of org.apache.axis.utils.Options

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.