本文整理匯總了Java中org.apache.axis.client.Call.setUsername方法的典型用法代碼示例。如果您正苦於以下問題:Java Call.setUsername方法的具體用法?Java Call.setUsername怎麽用?Java Call.setUsername使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.axis.client.Call
的用法示例。
在下文中一共展示了Call.setUsername方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createCall
import org.apache.axis.client.Call; //導入方法依賴的package包/類
private Call createCall() throws RemoteException {
try {
Call _call = super._createCall();
if (super.maintainSessionSet) {
_call.setMaintainSession(super.maintainSession);
}
if (super.cachedUsername != null) {
_call.setUsername(super.cachedUsername);
}
if (super.cachedPassword != null) {
_call.setPassword(super.cachedPassword);
}
if (super.cachedEndpoint != null) {
_call.setTargetEndpointAddress(super.cachedEndpoint);
}
if (super.cachedTimeout != null) {
_call.setTimeout(super.cachedTimeout);
}
if (super.cachedPortName != null) {
_call.setPortName(super.cachedPortName);
}
java.util.Enumeration keys = super.cachedProperties.keys();
while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
_call.setProperty(key, super.cachedProperties.get(key));
}
return _call;
} catch (Throwable _t) {
throw new AxisFault("Failure trying to get the Call object", _t);
}
}
示例2: main
import org.apache.axis.client.Call; //導入方法依賴的package包/類
public static void main(String args[]) {
try {
Options opts = new Options( args );
args = opts.getRemainingArgs();
if ( args == null || args.length % 2 != 0 ) {
System.err.println( "Usage: GetInfo <symbol> <datatype>" );
System.exit(1);
}
String symbol = args[0] ;
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(opts.getURL()) );
call.setOperationName( new QName("urn:cominfo", "getInfo") );
call.addParameter( "symbol", XMLType.XSD_STRING, ParameterMode.IN );
call.addParameter( "info", XMLType.XSD_STRING, ParameterMode.IN );
call.setReturnType( XMLType.XSD_STRING );
call.setUsername( opts.getUser() );
call.setPassword( opts.getPassword() );
String res = (String) call.invoke( new Object[] { args[0], args[1] } );
System.out.println( symbol + ": " + res );
}
catch( Exception e ) {
e.printStackTrace();
}
}
示例3: getQuote1
import org.apache.axis.client.Call; //導入方法依賴的package包/類
/**
* 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 = new Service( new URL("file:GetQuote.wsdl"), servQN );
Call 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( new URL(opts.getURL()) );
/* Define some service specific properties */
/*******************************************/
call.setUsername( opts.getUser() );
call.setPassword( opts.getPassword() );
/* Get symbol and invoke the service */
/*************************************/
Object result = call.invoke( new Object[] { symbol = args[0] } );
return( ((Float) result).floatValue() );
}
示例4: 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();
}
示例5: getQuote
import org.apache.axis.client.Call; //導入方法依賴的package包/類
public float getQuote (String args[]) throws Exception {
Options opts = new Options( args );
args = opts.getRemainingArgs();
if ( args == null ) {
System.err.println( "Usage: GetQuote <symbol>" );
System.exit(1);
}
symbol = args[0] ;
// 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");
}
URL url = new URL(opts.getURL());
String user = opts.getUser();
String passwd = opts.getPassword();
Service service = new Service();
Float res = new Float(0.0F);
for (int i=0; i<count; i++) {
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( url );
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( user );
call.setPassword( passwd );
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();
}
示例6: getQuote2
import org.apache.axis.client.Call; //導入方法依賴的package包/類
/**
* 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 = new Service();
Call 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( new URL(opts.getURL()) );
call.setUseSOAPAction( true );
call.setSOAPActionURI( "getQuote" );
call.setEncodingStyle( "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.setUsername( opts.getUser() );
call.setPassword( opts.getPassword() );
/* Get symbol and invoke the service */
/*************************************/
Object result = call.invoke( new Object[] { symbol = args[0] } );
return( ((Float) result).floatValue() );
}
示例7: getQuote3
import org.apache.axis.client.Call; //導入方法依賴的package包/類
/**
* 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 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 = new Service( new URL("file:GetQuote.wsdl"), servQN );
Call 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( new URL(opts.getURL()) );
/* Define some service specific properties */
/*******************************************/
call.setUsername( opts.getUser() );
call.setPassword( opts.getPassword() );
/* Get symbol and invoke the service */
/*************************************/
Object result = call.invoke( new Object[] { symbol = args[0] } );
result = call.invoke( new Object[] { symbol = args[0] } );
/* Reuse the call object to call the test method */
/*************************************************/
call.setOperation( portQN, "test" );
call.setReturnType( XMLType.XSD_STRING );
System.out.println( call.invoke(new Object[]{}) );
return( ((Float) result).floatValue() );
}
示例8: 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();
}