bp.getRequestContext().put(org.apache.axis2.jaxws.util.Constants.USE_ASYNC_MEP,
Boolean.TRUE);
}
// Set up the callback handler and create the input object
EchoServiceCallbackHandler callbackHandler = new EchoServiceCallbackHandler();
EchoStringInput echoParm =
new org.apache.axis2.jaxws.samples.echo.ObjectFactory().createEchoStringInput();
echoParm.setEchoInput(input);
System.out.println(">> CLIENT: SEI Async to " + endpointURL);
// Call the service
Future<?> resp = echo.echoOperationAsync(echoParm, callbackHandler);
Thread.sleep(1000);
while (!resp.isDone()) {
// Check for timeout
if (waiting <= 0) {
System.out
.println(">> CLIENT: ERROR - SEI Async Timeout waiting for reply.");
return response + "Async timeout waiting for reply.";
}
System.out
.println(">> CLIENT: SEI Async invocation still not complete");
Thread.sleep(1000 * SLEEPER);
waiting -= SLEEPER;
}
// Get the response and print it, then return
EchoStringResponse esr = callbackHandler.getResponse();
System.out.println(">> CLIENT: SEI Async invocation complete.");
if (null != esr) {
response = esr.getEchoResponse();
if (null != response) {
System.out.println(">> CLIENT: SEI Async response is: " + response);