本文整理汇总了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();
}