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 36 public class SyncPingClient { 37 38 private static String defaultServerPort = "8070"; 39 40 private static String targetURL = "http://127.0.0.1:" + defaultServerPort + 41 "/axis/services/RMSampleService"; 42 43 public static void main(String [] args) { 44 System.out.println("Client started...... Synchronous "); 45 try { 46 47 48 Service service = new Service(); 49 Call call = (Call) service.createCall(); 50 51 SandeshaContext ctx = new SandeshaContext(Constants.SYNCHRONOUS); 52 ctx.initCall(call, targetURL, "urn:wsrm:Ping", 53 Constants.ClientProperties.IN_ONLY); 54 55 call.setOperationName(new QName ("http://tempuri.org/", "Ping")); 56 call.addParameter("arg1", XMLType.XSD_STRING, ParameterMode.IN); 57 58 call.invoke(new Object []{"Ping Message Number One"}); 59 call.invoke(new Object []{"Ping Message Number Two"}); 60 ctx.setLastMessage(call); 61 call.invoke(new Object []{"Ping Message Number Three"}); 62 63 RMReport report = ctx.endSequence(); 64 65 66 if (report != null) { 67 System.out.println("\n***********Printing RM Report***********"); 68 System.out.println("Is all messages acked - " + report.isAllAcked()); 69 System.out.println("****************************************\n"); 70 } 71 72 } catch (Exception e) { 73 e.printStackTrace(); 74 } 75 } 76 } 77 | Popular Tags |