1 16 17 package samples.stock ; 18 19 import org.apache.axis.client.Call; 20 import org.apache.axis.client.Service; 21 import org.apache.axis.encoding.XMLType; 22 import org.apache.axis.utils.Options; 23 24 import javax.xml.namespace.QName ; 25 import javax.xml.rpc.ParameterMode ; 26 27 31 public class GetInfo { 32 33 public static void main(String args[]) { 34 try { 35 Options opts = new Options( args ); 36 37 args = opts.getRemainingArgs(); 38 39 if ( args == null || args.length % 2 != 0 ) { 40 System.err.println( "Usage: GetInfo <symbol> <datatype>" ); 41 System.exit(1); 42 } 43 44 String symbol = args[0] ; 45 Service service = new Service(); 46 Call call = (Call) service.createCall(); 47 48 call.setTargetEndpointAddress( new java.net.URL (opts.getURL()) ); 49 call.setOperationName( new QName ("urn:cominfo", "getInfo") ); 50 call.addParameter( "symbol", XMLType.XSD_STRING, ParameterMode.IN ); 51 call.addParameter( "info", XMLType.XSD_STRING, ParameterMode.IN ); 52 call.setReturnType( XMLType.XSD_STRING ); 53 call.setUsername( opts.getUser() ); 54 call.setPassword( opts.getPassword() ); 55 56 String res = (String ) call.invoke( new Object [] { args[0], args[1] } ); 57 58 System.out.println( symbol + ": " + res ); 59 } 60 catch( Exception e ) { 61 e.printStackTrace(); 62 } 63 } 64 65 } 66 67 | Popular Tags |