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