1 17 18 package org.apache.sandesha.samples; 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.RMReport; 25 import org.apache.sandesha.SandeshaContext; 26 27 import javax.xml.namespace.QName ; 28 import javax.xml.rpc.ParameterMode ; 29 30 35 public class AsyncPingClient { 36 private static String defaultServerPort = "8070"; 37 private static String defaultClientPort = "9070"; 38 private static String targetURL = "http://127.0.0.1:" + defaultServerPort + 39 "/axis/services/RMSampleService"; 40 41 public static void main(String [] args) { 42 System.out.println("Client started...... Asynchronous "); 43 try { 44 45 Service service = new Service(); 46 Call call = (Call) service.createCall(); 47 48 SandeshaContext ctx = new SandeshaContext(); 49 ctx.setAcksToURL("http://127.0.0.1:" + defaultClientPort + "/axis/services/RMService"); 50 ctx.setReplyToURL("http://127.0.0.1:" + defaultClientPort + "/axis/services/RMService"); 51 ctx.initCall(call, targetURL, "urn:wsrm:ping", Constants.ClientProperties.IN_ONLY); 52 53 call.setOperationName(new QName ("http://tempuri.org", "Ping")); 54 call.addParameter("Text", XMLType.XSD_STRING, ParameterMode.IN); 55 56 call.invoke(new Object []{"Ping Message Number One"}); 57 call.invoke(new Object []{"Ping Message Number Two"}); 58 ctx.setLastMessage(call); 59 call.invoke(new Object []{"Ping Message Number Three"}); 60 61 RMReport report = ctx.endSequence(); 62 63 64 System.out.println("\n***********Printing RM Report***********"); 65 System.out.println("Is all messages acked - " + report.isAllAcked()); 66 System.out.println("****************************************\n"); 67 68 69 } catch (Exception e) { 70 e.printStackTrace(); 71 } 72 } 73 } 74 | Popular Tags |