KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > samples > userguide > example4 > Client


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.example4;
18
19 import org.apache.axis.client.Call;
20 import org.apache.axis.client.Service;
21 import org.apache.axis.utils.Options;
22
23 import javax.xml.namespace.QName JavaDoc;
24
25 public class Client
26 {
27     public static void main(String JavaDoc [] args)
28     {
29         try {
30             Options options = new Options(args);
31             
32             String JavaDoc endpointURL = options.getURL();
33             
34             Service service = new Service();
35             Call call = (Call) service.createCall();
36
37             call.setTargetEndpointAddress( new java.net.URL JavaDoc(endpointURL) );
38             call.setOperationName( new QName JavaDoc("LogTestService", "testMethod") );
39
40             String JavaDoc res = (String JavaDoc) call.invoke( new Object JavaDoc[] {} );
41
42             System.out.println( res );
43         } catch (Exception JavaDoc e) {
44             System.err.println(e.toString());
45         }
46     }
47 }
48
Popular Tags