01: /*
02: * Copyright 2001-2004 The Apache Software Foundation.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
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: /**
28: *
29: * @author Doug Davis (dug@us.ibm.com.com)
30: */
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
41: .println("Usage: GetInfo <symbol> <datatype>");
42: System.exit(1);
43: }
44:
45: String symbol = args[0];
46: Service service = new Service();
47: Call call = (Call) service.createCall();
48:
49: call.setTargetEndpointAddress(new java.net.URL(opts
50: .getURL()));
51: call.setOperationName(new QName("urn:cominfo", "getInfo"));
52: call.addParameter("symbol", XMLType.XSD_STRING,
53: ParameterMode.IN);
54: call.addParameter("info", XMLType.XSD_STRING,
55: ParameterMode.IN);
56: call.setReturnType(XMLType.XSD_STRING);
57: call.setUsername(opts.getUser());
58: call.setPassword(opts.getPassword());
59:
60: String res = (String) call.invoke(new Object[] { args[0],
61: args[1] });
62:
63: System.out.println(symbol + ": " + res);
64: } catch (Exception e) {
65: e.printStackTrace();
66: }
67: }
68:
69: }
|