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.components.uuid.UUIDGen; 23 import org.apache.axis.components.uuid.UUIDGenFactory; 24 import org.apache.axis.encoding.XMLType; 25 import org.apache.sandesha.Constants; 26 import org.apache.sandesha.RMReport; 27 import org.apache.sandesha.SandeshaContext; 28 29 import javax.xml.namespace.QName ; 30 import javax.xml.rpc.ParameterMode ; 31 32 37 public class EchoClientSyncAck { 38 39 private static String defaultServerPort = "8070"; 40 private static String defaultClientPort = "9070"; 41 private static String targetURL = "http://127.0.0.1:" + defaultServerPort + 42 "/axis/services/RMSampleService"; 43 44 45 public static void main(String [] args) { 46 47 System.out.println("EchoClientSyncAck Started ........"); 48 49 try { 50 UUIDGen uuidGen = UUIDGenFactory.getUUIDGen(); String str = uuidGen.nextUUID(); 52 53 54 Service service = new Service(); 55 Call call = (Call) service.createCall(); 56 57 SandeshaContext ctx = new SandeshaContext(); 58 59 ctx.setAcksToURL(Constants.WSA.NS_ADDRESSING_ANONYMOUS); 60 ctx.setReplyToURL("http://127.0.0.1:" + defaultClientPort + "/axis/services/RMService"); 61 ctx.initCall(call, targetURL, "urn:wsrm:echoString", Constants.ClientProperties.IN_OUT); 62 63 call.setOperationName(new QName ("http://tempuri.org/", "echoString")); 64 65 call.addParameter("arg1", XMLType.XSD_STRING, ParameterMode.IN); 66 call.addParameter("arg2", XMLType.XSD_STRING, ParameterMode.IN); 67 call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING); 68 69 String ret = (String ) call.invoke(new Object []{"Sandesha Echo 1", str}); 70 System.out.println("The Response for First Messsage is :" + ret); 71 72 ret = (String ) call.invoke(new Object []{"Sandesha Echo 2", str}); 73 System.out.println("The Response for Second Messsage is :" + ret); 74 75 ctx.setLastMessage(call); 77 ret = (String ) call.invoke(new Object []{"Sandesha Echo 3", str}); 78 System.out.println("The Response for Third Messsage is :" + ret); 79 80 RMReport report = ctx.endSequence(); 81 82 83 if (report != null) { 84 System.out.println("\n***********Printing RM Report***********"); 85 System.out.println("Is all messages acked - " + report.isAllAcked()); 86 System.out.println("No of response messages - " + report.getNumberOfReturnMessages()); 87 System.out.println("****************************************\n"); 88 } 89 90 91 } catch (Exception e) { 92 e.printStackTrace(); 93 } 94 } 95 } 96 | Popular Tags |