KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > sandesha > interop > IBMAsyncPing


1 /*
2 * Copyright 1999-2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
6 * 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, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
14 * the License.
15 *
16 */

17
18 package org.apache.sandesha.interop;
19
20 import org.apache.axis.client.Call;
21 import org.apache.axis.client.Service;
22 import org.apache.axis.encoding.XMLType;
23 import org.apache.sandesha.Constants;
24 import org.apache.sandesha.SandeshaContext;
25
26 import javax.xml.namespace.QName JavaDoc;
27 import javax.xml.rpc.ParameterMode JavaDoc;
28
29 /**
30  * Test client for Ping scenario for IBM.
31  *
32  * @author Jaliya Ekanyake
33  */

34 public class IBMAsyncPing {
35
36     private static String JavaDoc targetURL = "http://127.0.0.1:8080/wsrm/services/rmDemos";
37     private static String JavaDoc sourceHost = "192.248.18.51"; //Change this to your public IP address
38
private static String JavaDoc sourcePort = "9070"; //Change this according to the listening port of the TCPMonitor in the
39
//client side.
40

41     public static void main(String JavaDoc[] args) {
42         System.out.println("Client started...... Asynchronous Ping - IBM");
43         try {
44
45             Service service = new Service();
46             Call call = (Call) service.createCall();
47
48             SandeshaContext ctx = new SandeshaContext();
49
50             ctx.setToURL("http://wsi.alphaworks.ibm.com:8080/wsrm/services/rmDemos");
51             ctx.setFaultToURL("http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
52             ctx.setAcksToURL("http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
53             ctx.setFromURL("http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
54
55             ctx.initCall(call, targetURL, "urn:wsrm:Ping", Constants.ClientProperties.IN_ONLY);
56
57             call.setOperationName(new QName JavaDoc("http://tempuri.org/", "Ping"));
58
59             call.addParameter("Text", XMLType.XSD_STRING, ParameterMode.IN);
60
61             call.invoke(new Object JavaDoc[]{"Ping Message Number One"});
62             call.invoke(new Object JavaDoc[]{"Ping Message Number Two"});
63             ctx.setLastMessage(call);
64             call.invoke(new Object JavaDoc[]{"Ping Message Number Three"});
65
66             ctx.endSequence();
67
68         } catch (Exception JavaDoc e) {
69             e.printStackTrace();
70         }
71     }
72 }
73
Popular Tags