KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.apache.sandesha.interop;
2
3 import org.apache.axis.client.Call;
4 import org.apache.axis.client.Service;
5 import org.apache.axis.encoding.XMLType;
6 import org.apache.sandesha.Constants;
7 import org.apache.sandesha.SandeshaContext;
8
9 import javax.xml.namespace.QName JavaDoc;
10 import javax.xml.rpc.ParameterMode JavaDoc;
11
12 /**
13  * Test client for Ping scenario for Systinet.
14  *
15  * @author Jaliya Ekanyake
16  */

17 public class SystinetAsyncPing {
18
19     private static String JavaDoc targetURL = "http://127.0.0.1:6064/Service";
20     private static String JavaDoc sourceHost = "192.248.18.51"; //Change this to your public IP address
21
private static String JavaDoc sourcePort = "9070"; //Change this according to the listening port of the TCPMonitor in the
22
//client side.
23

24     public static void main(String JavaDoc[] args) {
25         System.out.println("Client started...... Synchronous ");
26         try {
27
28             Service service = new Service();
29             Call call = (Call) service.createCall();
30
31             SandeshaContext ctx = new SandeshaContext();
32
33             ctx.setToURL("http://soap.systinet.net:6064/Service");
34             ctx.setAcksToURL("http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
35             ctx.setFromURL("http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
36             ctx.setFaultToURL("http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
37
38             ctx.initCall(call, targetURL, "urn:wsrm:Ping", Constants.ClientProperties.IN_ONLY);
39
40             call.setOperationName(new QName JavaDoc("http://tempuri.org/", "Ping"));
41
42             call.addParameter("arg1", XMLType.XSD_STRING, ParameterMode.IN);
43
44             call.invoke(new Object JavaDoc[]{"Ping Message Number One"});
45
46             call.invoke(new Object JavaDoc[]{"Ping Message Number Two"});
47             ctx.setLastMessage(call);
48             call.invoke(new Object JavaDoc[]{"Ping Message Number Three"});
49
50             ctx.endSequence();
51
52         } catch (Exception JavaDoc e) {
53             e.printStackTrace();
54         }
55     }
56 }
Popular Tags