options.setTo(targetEPR);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setUseSeparateListener(true);
options.setAction(operationName.getLocalPart());
AxisCallback callback = new AxisCallback() {
/**
* This is called when we receive a message.
*
* @param msgContext the (response) MessageContext
*/
public void onMessage(MessageContext msgContext) {
OMElement result = msgContext.getEnvelope().getBody().getFirstElement();
TestingUtils.compareWithCreatedOMElement(result);
log.debug("result = " + result);
}
/**
* This gets called when a fault message is received.
*
* @param msgContext the MessageContext containing the fault.
*/
public void onFault(MessageContext msgContext) {
fail("Fault received");
}
/**
* This gets called ONLY when an internal processing exception occurs.
*
* @param e the Exception which caused the problem
*/
public void onError(Exception e) {
}
/** This is called at the end of the MEP no matter what happens, quite like a finally block. */
public synchronized void onComplete() {
finish = true;
notify();
}
};
sender = new ServiceClient(configcontext, service);
sender.setOptions(options);
sender.sendReceiveNonBlocking(operationName, method, callback);
log.info("send the request");
synchronized (callback) {
if (!finish) {
callback.wait(45000);
if (!finish) {
throw new AxisFault(
"Server was shutdown as the async response take too long to complete");
}
}