Package org.apache.axis.utils

Examples of org.apache.axis.utils.Options


      String deployEndpoint = getEndpoint(temp, environment);

      try
      {
         AdminClient deployer = new AdminClient();
         Options options = new Options(null);
         options.setDefaultURL(deployEndpoint);
         InputStream wsdd = getClass().getResourceAsStream(SERVER_DEPLOY_WSDD);
         if (wsdd == null) throw new IOException("Could not find AXIS deployment descriptor");
         deployer.process(options, wsdd);
      }
      catch (RuntimeException x)
View Full Code Here


      String undeployEndpoint = getEndpoint(temp, environment);

      try
      {
         AdminClient deployer = new AdminClient();
         Options options = new Options(null);
         options.setDefaultURL(undeployEndpoint);
         InputStream wsdd = getClass().getResourceAsStream(SERVER_UNDEPLOY_WSDD);
         if (wsdd == null) throw new IOException("Could not find AXIS deployment descriptor " + SERVER_UNDEPLOY_WSDD);
         deployer.process(options, wsdd);
      }
      catch (Exception x)
View Full Code Here

    private static final java.lang.String address =
    "http://localhost:8081/axis/services/SecHttp";


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

        /*
          * Start to prepare service call. Once this is done, several
          * calls can be made on the port (see below)
         *
          * Fist: get the service locator. This implements the functionality
          * to get a client stub (aka port).
          */
        SecServiceLocator service = new SecServiceLocator();
        /*
          * this is a JAX-RPC compliant call. It uses a preconfigured
          * endpoint address (usually contained in the WSDL). Note the
          * cast.
          *
        SecPort port = (SwaPort)service.getPort(SwaPortType.class);
         */

        /*
          * Here we use an Axis specific call that allows to override the
          * port address (service endpoint address) with an own URL. Comes
          * in handy for testing.
          */
        java.net.URL endpoint;
            try {
                endpoint = new java.net.URL(address);
            }
            catch (java.net.MalformedURLException e) {
                throw new javax.xml.rpc.ServiceException(e);
            }

        SecPort port = (SecPort)service.getSecHttp(endpoint);
        /*
          * At this point all preparations are done. Using the port we can
          * now perform as many calls as necessary.
          */
   
         // perform call
        String result = port.secSend("AppName");
        System.out.println(result);
       
        if (opts.isFlagSet('t') > 0) {
            long startTime = System.currentTimeMillis();
            for (int i = 0; i < 20; i++)
                port.secSend("AppName");
            long endTime = System.currentTimeMillis();
            System.out.println("Time used: " + (endTime - startTime) + "ms");
View Full Code Here

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

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

        String maxPoolSize = opts.isValueSet( 't' );
        if ( maxPoolSize == null )
        {
            maxPoolSize = ThreadPool.DEFAULT_MAX_THREADS + "";
        }

        String maxSessions = opts.isValueSet( 'm' );
        if ( maxSessions == null )
        {
            maxSessions = DEFAULT_MAX_SESSIONS + "";
        }

        String[] nonOptionArgs = opts.getRemainingArgs();
        NotSoSimpleAxisServer server = new NotSoSimpleAxisServer( new File( nonOptionArgs[0] ), Integer.parseInt( maxPoolSize ),
                Integer.parseInt( maxSessions ) );

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

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

    // helper function; does all the real work
    public float getQuote (String args[]) throws Exception {
        Call.addTransportPackage("samples.transport");
        Call.setTransportForProtocol("tcp", TCPTransport.class);
       
        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] ;

        EngineConfiguration defaultConfig =
            (new DefaultEngineConfigurationFactory()).
            getClientEngineConfig();
        SimpleProvider config = new SimpleProvider(defaultConfig);
        SimpleTargetedChain c = new SimpleTargetedChain(new TCPSender());
        config.deployTransport("tcp", c);

        Service service = new Service(config);
        Call call = (Call)service.createCall();
       
        call.setTransport(new TCPTransport());
       
        call.setTargetEndpointAddress( new URL(opts.getURL()) );
        call.setOperationName( new QName("urn:xmltoday-delayed-quotes", "getQuote") );
        call.addParameter( "symbol", XMLType.XSD_STRING, ParameterMode.IN );
        call.setReturnType( XMLType.XSD_FLOAT );
       
        // TESTING HACK BY ROBJ
        if (symbol.equals("XXX_noaction")) {
            symbol = "XXX";
        }
       
        call.setUsername( opts.getUser() );
        call.setPassword( 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

        //Service service=new Service(new URL("file:ElementService.wsdl"),sqn);
        Service service = new Service(new URL(sURL+"?wsdl"),sqn);
        Call    call    = (Call) service.createCall( pqn, "echoElement" );

        Options opts = new Options(args);
        opts.setDefaultURL( call.getTargetEndpointAddress() );
        call.setTargetEndpointAddress( new URL(opts.getURL()) );

        Element elem = XMLUtils.newDocument(bais).getDocumentElement();

        elem = (Element) call.invoke( new Object[] { "a string", elem } );
        return( XMLUtils.ElementToString( elem ) );
View Full Code Here

        return resp;
    }
   
    public static void main (String[] args) throws Exception {
        try {
            Options opts = new Options(args);

            System.err.println ("Using proxy without session maintenance.");
            System.err.println ("(queries without session should say:  \"ADDRESS NOT FOUND!\")");

            AddressBookService abs = new AddressBookServiceLocator();
            opts.setDefaultURL( abs.getAddressBookAddress() );
            URL serviceURL = new URL(opts.getURL());

            AddressBook ab1 = null;
            if (serviceURL == null) {
                ab1 = abs.getAddressBook();
            }
View Full Code Here

    /**
     * This will use the WSDL to prefill all of the info needed to make
     * the call.  All that's left is filling in the args to invoke().
     */
    public float getQuote1(String args[]) throws Exception {
        Options opts = new Options(args);

        args = opts.getRemainingArgs();

        if (args == null) {
            System.err.println("Usage: GetQuote <symbol>");
            System.exit(1);
        }

        /* Define the service QName and port QName */
        /*******************************************/
        QName servQN = new QName("urn:xmltoday-delayed-quotes",
                "GetQuoteService");
        QName portQN = new QName("urn:xmltoday-delayed-quotes", "GetQuote");

        /* Now use those QNames as pointers into the WSDL doc */
        /******************************************************/
        Service service = ServiceFactory.newInstance().createService(
                new URL("file:samples/stock/GetQuote.wsdl"), servQN);
        Call call = service.createCall(portQN, "getQuote");

        /* Strange - but allows the user to change just certain portions of */
        /* the URL we're gonna use to invoke the service.  Useful when you  */
        /* want to run it thru tcpmon (ie. put  -p81 on the cmd line).      */
        /********************************************************************/
        opts.setDefaultURL(call.getTargetEndpointAddress());
        call.setTargetEndpointAddress(opts.getURL());

        /* Define some service specific properties */
        /*******************************************/
        call.setProperty(Call.USERNAME_PROPERTY, opts.getUser());
        call.setProperty(Call.PASSWORD_PROPERTY, opts.getPassword());

        /* Get symbol and invoke the service */
        /*************************************/
        Object result = call.invoke(new Object[] {symbol = args[0]});

View Full Code Here

    /**
     * This will do everything manually (ie. no WSDL).
     */
    public float getQuote2(String args[]) throws Exception {
        Options opts = new Options(args);

        args = opts.getRemainingArgs();

        if (args == null) {
            System.err.println("Usage: GetQuote <symbol>");
            System.exit(1);
        }

        /* Create default/empty Service and Call object */
        /************************************************/
        Service service = ServiceFactory.newInstance().createService(null);
        Call call = service.createCall();

        /* Strange - but allows the user to change just certain portions of */
        /* the URL we're gonna use to invoke the service.  Useful when you  */
        /* want to run it thru tcpmon (ie. put  -p81 on the cmd line).      */
        /********************************************************************/
        opts.setDefaultURL("http://localhost:8080/axis/servlet/AxisServlet");

        /* Set all of the stuff that would normally come from WSDL */
        /***********************************************************/
        call.setTargetEndpointAddress(opts.getURL());
        call.setProperty(Call.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
        call.setProperty(Call.SOAPACTION_URI_PROPERTY, "getQuote");
        call.setProperty(Call.ENCODINGSTYLE_URI_PROPERTY,
                "http://schemas.xmlsoap.org/soap/encoding/");
        call.setOperationName(new QName("urn:xmltoday-delayed-quotes", "getQuote"));
        call.addParameter("symbol", XMLType.XSD_STRING, ParameterMode.IN);
        call.setReturnType(XMLType.XSD_FLOAT);

        /* Define some service specific properties */
        /*******************************************/
        call.setProperty(Call.USERNAME_PROPERTY, opts.getUser());
        call.setProperty(Call.PASSWORD_PROPERTY, opts.getPassword());

        /* Get symbol and invoke the service */
        /*************************************/
        Object result = call.invoke(new Object[] {symbol = args[0]});

View Full Code Here

    /**
     * This method does the same thing that getQuote1 does, but in
     * addition it reuses the Call object to make another call.
     */
    public float getQuote3(String args[]) throws Exception {
        Options opts = new Options(args);

        args = opts.getRemainingArgs();

        if (args == null) {
            System.err.println("Usage: GetQuote <symbol>");
            System.exit(1);
        }

        /* Define the service QName and port QName */
        /*******************************************/
        QName servQN = new QName("urn:xmltoday-delayed-quotes",
                "GetQuoteService");
        QName portQN = new QName("urn:xmltoday-delayed-quotes", "GetQuote");

        /* Now use those QNames as pointers into the WSDL doc */
        /******************************************************/
        Service service = ServiceFactory.newInstance().createService(
                new URL("file:samples/stock/GetQuote.wsdl"), servQN);
        Call call = service.createCall(portQN, "getQuote");

        /* Strange - but allows the user to change just certain portions of */
        /* the URL we're gonna use to invoke the service.  Useful when you  */
        /* want to run it thru tcpmon (ie. put  -p81 on the cmd line).      */
        /********************************************************************/
        opts.setDefaultURL(call.getTargetEndpointAddress());
        call.setTargetEndpointAddress(opts.getURL());

        /* Define some service specific properties */
        /*******************************************/
        call.setProperty(Call.USERNAME_PROPERTY, opts.getUser());
        call.setProperty(Call.PASSWORD_PROPERTY, opts.getPassword());

        /* Get symbol and invoke the service */
        /*************************************/
        Object result = call.invoke(new Object[] {symbol = 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.