String convIdFromThread = createConversationID();
msg.setConversationID(convIdFromThread);
}
}
Invoker headInvoker = chain.getHeadInvoker();
msg.setCorrelationID(msgContext.getCorrelationID());
Operation operation = chain.getTargetOperation();
Interface contract = operation.getInterface();
if (contract != null && contract.isConversational()) {
ConversationSequence sequence = chain.getTargetOperation().getConversationSequence();
if (sequence == ConversationSequence.CONVERSATION_END) {
msg.setConversationSequence(ConversationSequence.CONVERSATION_END);
conversationStarted = false;
} else if (sequence == ConversationSequence.CONVERSATION_CONTINUE) {
if (conversationStarted) {
msg.setConversationSequence(ConversationSequence.CONVERSATION_CONTINUE);
} else {
conversationStarted = true;
msg.setConversationSequence(ConversationSequence.CONVERSATION_START);
}
}
}
msg.setBody(args);
msg.setFrom(wire.getSource());
msg.setTo(wire.getTarget());
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;