String axis2_xml = AXIS2_CLIENT_PATH + "client_axis2.xml";
ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);
ServiceClient serviceClient = new ServiceClient (configContext,null);
Options clientOptions = new Options ();
// clientOptions.setProperty(Options.COPY_PROPERTIES,new Boolean (true));
clientOptions.setTo(new EndpointReference (toAddress));
String acksTo = null; //serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
String sequenceKey = "sequence4";
clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToAddress);
// clientOptions.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE); //uncomment this to send messages without chunking.
// clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); //uncomment this to send messages in SOAP 1.2
clientOptions.setProperty(SandeshaClientConstants.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1); //uncomment this to send the messages according to the v1_1 spec.
// clientOptions.setProperty(SandeshaClient.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID()); //Uncomment this to offer a sequenceID for the incoming sequence.
// clientOptions.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,AddressingConstants.Submission.WSA_NAMESPACE);
clientOptions.setAction("urn:wsrm:EchoString");
//You must set the following two properties in the request-reply case.
clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
clientOptions.setUseSeparateListener(true);
serviceClient.setOptions(clientOptions);
Callback callback1 = new TestCallback ("Callback 1");
serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo1",sequenceKey),callback1);
Callback callback2 = new TestCallback ("Callback 2");
serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo2",sequenceKey),callback2);
Callback callback3 = new TestCallback ("Callback 3");
serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo3",sequenceKey),callback3);
while (!callback3.isComplete()) {
Thread.sleep(1000);
}