if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
System.out.println("ERROR: Please set the directory you unzipped Sandesha2 as the first option.");
return;
}
Call call = new Call(AXIS2_CLIENT_PATH);
call.engageModule(new QName("Sandesha2-0.9"));
Options clientOptions = new Options ();
clientOptions.setProperty(Options.COPY_PROPERTIES,new Boolean (true));
call.setClientOptions(clientOptions);
//You must set the following two properties in the request-reply case.
clientOptions.setListenerTransportProtocol(Constants.TRANSPORT_HTTP);
clientOptions.setUseSeparateListener(true);
clientOptions.setProperty(Sandesha2ClientAPI.AcksTo,acksToEPR);
clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
clientOptions.setTo(new EndpointReference(toEPR));
clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,toEPR);
clientOptions.setProperty(Sandesha2ClientAPI.SEQUENCE_KEY,"sequence1"); //Optional
clientOptions.setSoapAction("test:soap:action");
clientOptions.setProperty(Sandesha2ClientAPI.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID()); //Optional
Callback callback1 = new TestCallback ("Callback 1");
call.invokeNonBlocking("echoString", getEchoOMBlock("echo1"),callback1);
Callback callback2 = new TestCallback ("Callback 2");
call.invokeNonBlocking("echoString", getEchoOMBlock("echo2"),callback2);
clientOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, "true");
Callback callback3 = new TestCallback ("Callback 3");
call.invokeNonBlocking("echoString", getEchoOMBlock("echo3"),callback3);
while (!callback3.isComplete()) {
Thread.sleep(1000);
}
call.close();
}