本文整理匯總了Java中org.apache.axis.client.Call.setTransport方法的典型用法代碼示例。如果您正苦於以下問題:Java Call.setTransport方法的具體用法?Java Call.setTransport怎麽用?Java Call.setTransport使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.axis.client.Call
的用法示例。
在下文中一共展示了Call.setTransport方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: main
import org.apache.axis.client.Call; //導入方法依賴的package包/類
public static void main(String args[]) throws Exception {
FileReader reader = new FileReader();
reader.setDaemon(true);
reader.start();
Options opts = new Options( args );
args = opts.getRemainingArgs();
if ( args == null ) {
System.err.println( "Usage: GetQuote <symbol>" );
System.exit(1);
}
String symbol = args[0] ;
Service service = new Service(new XMLStringProvider(wsdd));
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( new FileTransport() );
call.setUsername(opts.getUser() );
call.setPassword(opts.getPassword() );
call.setTimeout(new Integer(10000));
Float res = new Float(0.0F);
res = (Float) call.invoke( new Object[] {symbol} );
System.out.println( symbol + ": " + res );
reader.halt();
}
示例2: getQuote
import org.apache.axis.client.Call; //導入方法依賴的package包/類
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");
}
Float res = new Float(0.0F);
for (int i=0; i<count; i++) {
Object ret = call.invoke(new Object[] {symbol} );
if (ret instanceof String) {
System.out.println("Received problem response from server: "+ret);
throw new AxisFault("", (String)ret, null, null);
}
res = (Float) ret;
}
return res.floatValue();
}
示例3: main
import org.apache.axis.client.Call; //導入方法依賴的package包/類
public static void main(String args[]) throws Exception {
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();
}