1 17 package org.apache.sandesha.interop; 18 19 import org.apache.axis.Message; 20 import org.apache.axis.client.Call; 21 import org.apache.axis.client.Service; 22 import org.apache.sandesha.Constants; 23 import org.apache.sandesha.SandeshaContext; 24 25 30 public class MicrosoftAsyncPing { 31 32 private static String sourceHost = "192.248.18.51"; private static String sourcePort = "9070"; private static String targetURL = "http://127.0.0.1:8080/SecureReliableMessaging/ReliableOneWayDual.svc"; 35 36 public static void main(String [] args) { 37 System.out.println("Client started...... Asynchronous - Microsoft"); 38 try { 39 40 41 Service service = new Service(); 42 Call call = (Call) service.createCall(); 43 44 SandeshaContext ctx = new SandeshaContext(); 45 46 ctx.setToURL("http://131.107.153.195/SecureReliableMessaging/ReliableOneWayDual.svc"); 47 ctx.setFromURL("http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService"); 48 ctx.setAcksToURL("http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService"); 49 ctx.setFaultToURL("http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService"); 50 ctx.setReplyToURL("http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService"); 51 52 ctx.initCall(call, targetURL, "urn:wsrm:Ping", Constants.ClientProperties.IN_ONLY); 53 54 call.setOperationName("Ping"); 55 call.invoke(new Message(getSOAPEnvelope(1))); 56 call.invoke(new Message(getSOAPEnvelope(2))); 57 ctx.setLastMessage(call); 58 call.invoke(new Message(getSOAPEnvelope(3))); 59 60 ctx.endSequence(); 61 62 } catch (Exception e) { 63 e.printStackTrace(); 64 } 65 } 66 67 private static String getSOAPEnvelope(int i) { 68 return "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\">\n" + 69 " <soapenv:Header>\n" + " </soapenv:Header>\n" + " <soapenv:Body>\n" + " <Ping xmlns=\"http://tempuri.org/\">\n" + 70 " <Text>Ping Message Number " + i + "</Text>\n" + " </Ping>\n" + " </soapenv:Body></soapenv:Envelope>"; 71 } 72 } 73 | Popular Tags |