if (completed) {
throw new AxisFault(Messages.getMessage("mepiscomplted"));
}
// if the OUT message is not set on the operation context, throw a fault
MessageContext outMsgCtx = oc.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
if (outMsgCtx == null) {
throw new AxisFault(Messages.getMessage("outmsgctxnull"));
}
ConfigurationContext cfgCtx = sc.getConfigurationContext();
// set ClientOptions to the current outgoing message
outMsgCtx.setOptions(options);
// do Target Resolution
TargetResolver tr = cfgCtx.getAxisConfiguration().getTargetResolverChain();
if (tr != null) {
tr.resolveTarget(outMsgCtx);
}
// if the transport to use for sending is not specified, try to find it from the URL
TransportOutDescription transportOut = options.getTransportOut();
if (transportOut == null) {
EndpointReference toEPR =
(options.getTo() != null) ? options.getTo() : outMsgCtx.getTo();
transportOut =
ClientUtils.inferOutTransport(cfgCtx.getAxisConfiguration(), toEPR, outMsgCtx);
}
outMsgCtx.setTransportOut(transportOut);
if (options.getTransportIn() == null && outMsgCtx.getTransportIn() == null) {
outMsgCtx.setTransportIn(ClientUtils.inferInTransport(
cfgCtx.getAxisConfiguration(), options, outMsgCtx));
} else if (outMsgCtx.getTransportIn() == null) {
outMsgCtx.setTransportIn(options.getTransportIn());
}
// add reference parameters to To EPR
addReferenceParameters(outMsgCtx);
if (options.isUseSeparateListener()) {
options.setTransportIn(outMsgCtx.getConfigurationContext()
.getAxisConfiguration().getTransportIn(Constants.TRANSPORT_HTTP));
SynapseCallbackReceiver callbackReceiver =
(SynapseCallbackReceiver) axisOp.getMessageReceiver();
((Axis2MessageContext)((AsyncCallback)
axisCallback).getSynapseOutMsgCtx()).getAxis2MessageContext().setProperty(
NhttpConstants.IGNORE_SC_ACCEPTED, Constants.VALUE_TRUE);
callbackReceiver.addCallback(outMsgCtx.getMessageID(), axisCallback);
EndpointReference replyToFromTransport = outMsgCtx.getConfigurationContext()
.getListenerManager().getEPRforService(sc.getAxisService().getName(),
axisOp.getName().getLocalPart(), outMsgCtx.getTransportOut().getName());
if (outMsgCtx.getReplyTo() == null) {
outMsgCtx.setReplyTo(replyToFromTransport);
} else {
outMsgCtx.getReplyTo().setAddress(replyToFromTransport.getAddress());
}
outMsgCtx.getConfigurationContext().registerOperationContext(
outMsgCtx.getMessageID(), oc);
AxisEngine.send(outMsgCtx);
// Options object reused so soapAction needs to be removed so
// that soapAction+wsa:Action on response don't conflict
options.setAction("");
} else {
SynapseCallbackReceiver callbackReceiver =
(SynapseCallbackReceiver) axisOp.getMessageReceiver();
callbackReceiver.addCallback(outMsgCtx.getMessageID(), axisCallback);
send(outMsgCtx);
}
}