Package org.apache.axis.transport.jms

Examples of org.apache.axis.transport.jms.SimpleJMSListener


        HashMap cfMap = SimpleJMSListener.createCFMap(opts);
        String destination = opts.isValueSet('d');
        String username = opts.getUser();
        String password = opts.getPassword();
        // create the jms listener
        SimpleJMSListener listener = new SimpleJMSListener(connectorMap,
                                                           cfMap,
                                                           destination,
                                                           username,
                                                           password,
                                                           false);
        listener.start();

        args = opts.getRemainingArgs();
        if ( args == null || args.length == 0)
            printUsage();

        Service  service = new Service(new XMLStringProvider(wsdd));

        // create the transport
        JMSTransport transport = new JMSTransport(connectorMap, cfMap);

        // create a new Call object
        Call     call    = (Call) service.createCall();

        call.setOperationName( new QName("urn:xmltoday-delayed-quotes", "getQuote") );
        call.addParameter( "symbol", XMLType.XSD_STRING, ParameterMode.IN );
        call.setReturnType( XMLType.XSD_FLOAT );
        call.setTransport(transport);

        // set additional params on the call if desired
        //call.setUsername(username );
        //call.setPassword(password );
        //call.setProperty(JMSConstants.WAIT_FOR_RESPONSE, Boolean.FALSE);
        //call.setProperty(JMSConstants.PRIORITY, new Integer(5));
        //call.setProperty(JMSConstants.DELIVERY_MODE,
        //    new Integer(javax.jms.DeliveryMode.PERSISTENT));
        //call.setProperty(JMSConstants.TIME_TO_LIVE, new Long(20000));

        call.setProperty(JMSConstants.DESTINATION, destination);
        call.setTimeout(new Integer(10000));

        Float res = new Float(0.0F);

        // invoke a call for each of the symbols and print out
        for (int i = 0; i < args.length; i++) {
            res = (Float) call.invoke(new Object[] {args[i]});
            System.out.println(args[i] + ": " + res);
        }

        // shutdown
        listener.shutdown();
        transport.shutdown();
    }
View Full Code Here


        if ((opts.isFlagSet('?') > 0) || (opts.isFlagSet('h') > 0)) {
            printUsage();
        }

        // create the jms listener
        SimpleJMSListener listener = new SimpleJMSListener(opts);
        listener.start();

        args = opts.getRemainingArgs();
        if ( args == null ) {
            printUsage();
        }

        int numArgs = args.length;
        String[] symbols = new String[numArgs];
        for (int i = 0; i < numArgs; i++) {
            symbols[i] = args[i];
        }

        Service  service = new Service(new XMLStringProvider(wsdd));

        HashMap cfProps = new HashMap();
        cfProps.put(SonicConstants.BROKER_URL, opts.isValueSet('b'));
        cfProps.put(SonicConstants.DEFAULT_USERNAME, opts.getUser());
        cfProps.put(SonicConstants.DEFAULT_PASSWORD, opts.getPassword());

        // do we have a jndi name?
        String jndiName = opts.isValueSet('n');
        if (jndiName != null) {
            // w/ a jndi name, we can get the appropriate connection factory
            cfProps.put(JMSConstants.CONNECTION_FACTORY_JNDI_NAME, jndiName);
        } else {
            // w/o a jndi name, we default to using the Sonic-specific method
            // for creating a connection factory, which is by specifying the
            // appropriate connection factory class from SonicConstants.java

            // topics or queues?
            String cf = null;
            if (opts.isFlagSet('t') > 0) {
                cf = SonicConstants.TCF_CLASS;
            } else {
                cf = SonicConstants.QCF_CLASS;
            }
            cfProps.put(JMSConstants.CONNECTION_FACTORY_CLASS, cf);
        }

        // create the transport
        JMSTransport transport = new JMSTransport(null, cfProps);

        // create a new Call object
        Call     call    = (Call) service.createCall();

        call.setOperationName( new QName("urn:xmltoday-delayed-quotes", "getQuote") );
        call.addParameter( "symbol", XMLType.XSD_STRING, ParameterMode.IN );
        call.setReturnType( XMLType.XSD_FLOAT );
        call.setTransport(transport);

        // set additional params on the call if desired

        //call.setUsername(opts.getUser() );
        //call.setPassword(opts.getPassword() );

        //call.setProperty(JMSConstants.WAIT_FOR_RESPONSE, Boolean.FALSE);
        //call.setProperty(JMSConstants.PRIORITY, new Integer(5));
        //call.setProperty(JMSConstants.DELIVERY_MODE,
        //    new Integer(javax.jms.DeliveryMode.PERSISTENT));
        //call.setProperty(JMSConstants.TIME_TO_LIVE, new Long(20000));

        call.setProperty(JMSConstants.DESTINATION, "SampleQ1");
        call.setTimeout(new Integer(10000));

        Float res = new Float(0.0F);

        // invoke a call for each of the symbols and print out
        for (int i = 0; i < symbols.length; i++) {
            res = (Float) call.invoke(new Object[] {symbols[i]});
            System.out.println(symbols[i] + ": " + res);
        }

        // shutdown
        listener.shutdown();
        transport.shutdown();
    }
View Full Code Here

        HashMap cfMap = SimpleJMSListener.createCFMap(opts);
        String destination = opts.isValueSet('d');
        String username = opts.getUser();
        String password = opts.getPassword();
        // create the jms listener
        SimpleJMSListener listener = new SimpleJMSListener(connectorMap,
                                                           cfMap,
                                                           destination,
                                                           username,
                                                           password,
                                                           false);
        listener.start();

        args = opts.getRemainingArgs();
        if ( args == null || args.length == 0)
            printUsage();

        Service  service = new Service(new XMLStringProvider(wsdd));

        // create the transport
        JMSTransport transport = new JMSTransport(connectorMap, cfMap);

        // create a new Call object
        Call     call    = (Call) service.createCall();

        call.setOperationName( new QName("urn:xmltoday-delayed-quotes", "getQuote") );
        call.addParameter( "symbol", XMLType.XSD_STRING, ParameterMode.IN );
        call.setReturnType( XMLType.XSD_FLOAT );
        call.setTransport(transport);

        // set additional params on the call if desired
        //call.setUsername(username );
        //call.setPassword(password );
        //call.setProperty(JMSConstants.WAIT_FOR_RESPONSE, Boolean.FALSE);
        //call.setProperty(JMSConstants.PRIORITY, new Integer(5));
        //call.setProperty(JMSConstants.DELIVERY_MODE,
        //    new Integer(javax.jms.DeliveryMode.PERSISTENT));
        //call.setProperty(JMSConstants.TIME_TO_LIVE, new Long(20000));

        call.setProperty(JMSConstants.DESTINATION, destination);
        call.setTimeout(new Integer(10000));

        Float res = new Float(0.0F);

        // invoke a call for each of the symbols and print out
        for (int i = 0; i < args.length; i++)
        {
            try
            {
            res = (Float) call.invoke(new Object[] {args[i]});
            System.out.println(args[i] + ": " + res);
            }
            catch(AxisFault af)
            {
                System.out.println(af.dumpToString());
            }
        }

        // shutdown
        listener.shutdown();
        transport.shutdown();
    }
View Full Code Here

        HashMap cfMap = SimpleJMSListener.createCFMap(opts);
        String destination = opts.isValueSet('d');
        String username = opts.getUser();
        String password = opts.getPassword();
        // create the jms listener
        SimpleJMSListener listener = new SimpleJMSListener(connectorMap,
                                                           cfMap,
                                                           destination,
                                                           username,
                                                           password,
                                                           false);
        listener.start();

        args = opts.getRemainingArgs();
        if ( args == null || args.length == 0)
            printUsage();

        Service  service = new Service(new XMLStringProvider(wsdd));

        // create the transport
        JMSTransport transport = new JMSTransport(connectorMap, cfMap);

        // create a new Call object
        Call     call    = (Call) service.createCall();

        call.setOperationName( new QName("urn:xmltoday-delayed-quotes", "getQuote") );
        call.addParameter( "symbol", XMLType.XSD_STRING, ParameterMode.IN );
        call.setReturnType( XMLType.XSD_FLOAT );
        call.setTransport(transport);

        // set additional params on the call if desired
        //call.setUsername(username );
        //call.setPassword(password );
        //call.setProperty(JMSConstants.WAIT_FOR_RESPONSE, Boolean.FALSE);
        //call.setProperty(JMSConstants.PRIORITY, new Integer(5));
        //call.setProperty(JMSConstants.DELIVERY_MODE,
        //    new Integer(javax.jms.DeliveryMode.PERSISTENT));
        //call.setProperty(JMSConstants.TIME_TO_LIVE, new Long(20000));

        call.setProperty(JMSConstants.DESTINATION, destination);
        call.setTimeout(new Integer(10000));

        Float res = new Float(0.0F);

        // invoke a call for each of the symbols and print out
        for (int i = 0; i < args.length; i++)
        {
            try
            {
            res = (Float) call.invoke(new Object[] {args[i]});
            System.out.println(args[i] + ": " + res);
            }
            catch(AxisFault af)
            {
                System.out.println(af.dumpToString());
            }
        }

        // shutdown
        listener.shutdown();
        transport.shutdown();
    }
View Full Code Here

        HashMap connectorMap = SimpleJMSListener.createConnectorMap(opts);
        HashMap cfMap = SimpleJMSListener.createCFMap(opts);
        String destination = opts.isValueSet('d');

        // create the jms listener
        SimpleJMSListener listener = new SimpleJMSListener(connectorMap,
                                                           cfMap,
                                                           destination,
                                                           username,
                                                           password,
                                                           false);
        listener.start();

        args = opts.getRemainingArgs();
        if ( args == null || args.length == 0)
            printUsage();

        for (int i = 0; i < args.length; i++)
        {
            try
            {
                Float res = getQuote(args[i], username, password);
                System.out.println(args[i] + ": " + res);
            }
            catch(AxisFault af)
            {
                System.out.println(af.dumpToString());
            }
        }

        // shutdown
        listener.shutdown();

        // close all JMSConnectors whose configuration matches that of the JMS URL
        // note: this is optional, as all connectors will be closed upon exit
        JMSTransport.closeMatchingJMSConnectors(sampleJmsUrl, username, password);
View Full Code Here

        args = opts.getRemainingArgs();
        if ( args == null || args.length == 0)
            printUsage();

        // create the jms listener
        SimpleJMSListener listener = new SimpleJMSListener(connectorMap,
                                                           cfMap,
                                                           destination,
                                                           username,
                                                           password,
                                                           false);
        listener.start();

        JMSURLStubTest stubTest = new JMSURLStubTest("JMS URL static stub test");

        for (int i = 0; i < args.length; i++)
        {
            try
            {
                Float quote = stubTest.getQuote(args[i]);
                System.out.println(args[i] + ": " + quote);
            }
            catch(AxisFault af)
            {
                System.out.println(af.dumpToString());
            }
        }

        listener.shutdown();

        System.exit(1);
    }
View Full Code Here

        HashMap cfMap = SimpleJMSListener.createCFMap(opts);
        String destination = opts.isValueSet('d');
        String username = opts.getUser();
        String password = opts.getPassword();
        // create the jms listener
        SimpleJMSListener listener = new SimpleJMSListener(connectorMap,
                                                           cfMap,
                                                           destination,
                                                           username,
                                                           password,
                                                           false);
        listener.start();

        args = opts.getRemainingArgs();
        if ( args == null || args.length == 0)
            printUsage();

        Service  service = new Service(new XMLStringProvider(wsdd));

        // create the transport
        JMSTransport transport = new JMSTransport(connectorMap, cfMap);

        // create a new Call object
        Call     call    = (Call) service.createCall();

        call.setOperationName( new QName("urn:xmltoday-delayed-quotes", "getQuote") );
        call.addParameter( "symbol", XMLType.XSD_STRING, ParameterMode.IN );
        call.setReturnType( XMLType.XSD_FLOAT );
        call.setTransport(transport);

        // set additional params on the call if desired
        //call.setUsername(username );
        //call.setPassword(password );
        //call.setProperty(JMSConstants.WAIT_FOR_RESPONSE, Boolean.FALSE);
        //call.setProperty(JMSConstants.PRIORITY, new Integer(5));
        //call.setProperty(JMSConstants.DELIVERY_MODE,
        //    new Integer(javax.jms.DeliveryMode.PERSISTENT));
        //call.setProperty(JMSConstants.TIME_TO_LIVE, new Long(20000));

        call.setProperty(JMSConstants.DESTINATION, destination);
        call.setTimeout(new Integer(10000));

        Float res = new Float(0.0F);

        // invoke a call for each of the symbols and print out
        for (int i = 0; i < args.length; i++)
        {
            try
            {
            res = (Float) call.invoke(new Object[] {args[i]});
            System.out.println(args[i] + ": " + res);
            }
            catch(AxisFault af)
            {
                System.out.println(af.dumpToString());
            }
        }

        // shutdown
        listener.shutdown();
        transport.shutdown();
    }
View Full Code Here

        args = opts.getRemainingArgs();
        if ( args == null || args.length == 0)
            printUsage();

        // create the jms listener
        SimpleJMSListener listener = new SimpleJMSListener(connectorMap,
                                                           cfMap,
                                                           destination,
                                                           username,
                                                           password,
                                                           false);
        listener.start();

        JMSURLStubTest stubTest = new JMSURLStubTest("JMS URL static stub test");

        for (int i = 0; i < args.length; i++)
        {
            try
            {
                Float quote = stubTest.getQuote(args[i]);
                System.out.println(args[i] + ": " + quote);
            }
            catch(AxisFault af)
            {
                System.out.println(af.dumpToString());
            }
        }

        listener.shutdown();

        System.exit(1);
    }
View Full Code Here

TOP

Related Classes of org.apache.axis.transport.jms.SimpleJMSListener

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.