Options opts = new Options( args );
// first check if we should print usage
if ((opts.isFlagSet('?") > 0) || (opts.isFlagSet('h") > 0))
printUsage();
HashMap connectorMap = SimpleJMSListener.createConnectorMap(opts);
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();