String repoPath = "target" + File.separator + "repos" + File.separator + "client";
String axis2_xml = "target" + File.separator + "repos" + File.separator + "client" + File.separator + "client_axis2.xml";
ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
Options clientOptions = new Options ();
clientOptions.setAction(echoAction);
clientOptions.setTo(new EndpointReference (to));
String sequenceKey = SandeshaUtil.getUUID();
clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
ServiceClient serviceClient = new ServiceClient (configContext,null);
HashMap axisServices = configContext.getAxisConfiguration().getServices();
AxisService service = null;
Iterator values = axisServices.values().iterator();
while(values.hasNext())
service = (AxisService)values.next();
// Set the Sequence timout property to 1 second.
Iterator operations = service.getOperations();
while (operations.hasNext())
{
AxisOperation op = (AxisOperation) operations.next();
SandeshaPolicyBean propertyBean =
SandeshaUtil.getPropertyBean(op);
// Indicate that the sequence should timeout after 1 second
// And that it should be deleted after 2 seconds
if (propertyBean != null) {
propertyBean.setInactiveTimeoutInterval(1, "seconds");
propertyBean.setSequenceRemovalTimeoutInterval(2, "seconds");
}
}
// Set a bad acks to so the CreateSequence will be refused.
String acksTo = AddressingConstants.Final.WSA_NONE_URI;
clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
clientOptions.setUseSeparateListener(true);
clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
serviceClient.setOptions(clientOptions);
TestCallback callback1 = new TestCallback ("Callback 1");
serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo1",sequenceKey),callback1);