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.userguide.example3;
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: public class Client {
28: public static void main(String[] args) {
29: try {
30: Options options = new Options(args);
31:
32: String endpointURL = options.getURL();
33: String textToSend;
34:
35: args = options.getRemainingArgs();
36: if ((args == null) || (args.length < 1)) {
37: textToSend = "<nothing>";
38: } else {
39: textToSend = args[0];
40: }
41:
42: Service service = new Service();
43: Call call = (Call) service.createCall();
44:
45: call
46: .setTargetEndpointAddress(new java.net.URL(
47: endpointURL));
48: call.setOperationName(new QName(
49: "http://example3.userguide.samples",
50: "serviceMethod"));
51: call.addParameter("arg1", XMLType.XSD_STRING,
52: ParameterMode.IN);
53: call
54: .setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
55:
56: String ret = (String) call
57: .invoke(new Object[] { textToSend });
58:
59: System.out.println("You typed : " + ret);
60: } catch (Exception e) {
61: System.err.println(e.toString());
62: }
63: }
64: }
|