Debian Codegraph @

samples/userguide/example1/TestClient.java

raw
1 /*
2 * Copyright 2001-2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.example1;
18
19 import org.apache.axis.client.Call;
20 import org.apache.axis.client.Service;
21
22 import javax.xml.namespace.QName;
23
24 public class TestClient
25 {
26 public static void main(String [] args) {
27 try {
28 String endpoint =
29 "http://nagoya.apache.org:5049/axis/services/echo";
30
31 Service service = new Service();
32 Call call = (Call) service.createCall();
33
34 call.setTargetEndpointAddress( new java.net.URL(endpoint) );
35 call.setOperationName(new QName("http://soapinterop.org/", "echoString") );
36
37 // Call to addParameter/setReturnType as described in user-guide.html
38 //call.addParameter("testParam",
39 // org.apache.axis.Constants.XSD_STRING,
40 // javax.xml.rpc.ParameterMode.IN);
41 //call.setReturnType(org.apache.axis.Constants.XSD_STRING);
42
43 String ret = (String) call.invoke( new Object[] { "Hello!" } );
44
45 System.out.println("Sent 'Hello!', got '" + ret + "'");
46 } catch (Exception e) {
47 System.err.println(e.toString());
48 }
49 }
50 }