this.target = endpoint;
}
protected Object invoke(InvocationChain chain, Object[] args, RuntimeWire wire) throws Throwable {
Message msg = messageFactory.createMessage();
msg.setFrom(wire.getSource());
if (target != null) {
msg.setTo(target);
} else {
msg.setTo(wire.getTarget());
}
Invoker headInvoker = chain.getHeadInvoker();
Operation operation = chain.getTargetOperation();
msg.setOperation(operation);
msg.setBody(args);
Message msgContext = ThreadMessageContext.getMessageContext();
Object currentConversationID = msgContext.getFrom().getReferenceParameters().getConversationID();
conversationPreinvoke(msg, wire);
handleCallback(msg, wire, currentConversationID);
ThreadMessageContext.setMessageContext(msg);
try {
// dispatch the wire down the chain and get the response
Message resp = headInvoker.invoke(msg);
Object body = resp.getBody();
if (resp.isFault()) {
throw (Throwable)body;
}
return body;
} finally {
conversationPostInvoke(msg, wire);