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 MicrosoftSyncPing { 31 32 private static String targetURL = "http://127.0.0.1:8070/SecureReliableMessaging/ReliableOneWay.svc"; 33 34 public static void main(String [] args) { 35 System.out.println("Client started...... Synchronous - Microsoft "); 36 try { 37 38 Service service = new Service(); 39 Call call = (Call) service.createCall(); 40 41 SandeshaContext ctx = new SandeshaContext(Constants.SYNCHRONOUS); 42 43 ctx.setToURL("http://131.107.153.195/SecureReliableMessaging/ReliableOneWay.svc"); 44 ctx.setReplyToURL(Constants.WSA.NS_ADDRESSING_ANONYMOUS); 47 48 ctx.initCall(call, targetURL, "urn:wsrm:Ping", Constants.ClientProperties.IN_ONLY); 49 50 call.setOperationName("Ping"); 51 52 call.invoke(new Message(getSOAPEnvelope(1))); 53 call.invoke(new Message(getSOAPEnvelope(2))); 54 ctx.setLastMessage(call); 55 call.invoke(new Message(getSOAPEnvelope(3))); 56 57 ctx.endSequence(); 58 59 } catch (Exception e) { 60 e.printStackTrace(); 61 } 62 } 63 64 private static String getSOAPEnvelope(int i) { 65 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" + 66 " <soapenv:Header>\n" + " </soapenv:Header>\n" + " <soapenv:Body>\n" + " <Ping xmlns=\"http://tempuri.org/\">\n" + 67 " <Text>Ping Message Number " + i + "</Text>\n" + " </Ping>\n" + " </soapenv:Body></soapenv:Envelope>"; 68 69 } 70 } 71 | Popular Tags |