use of com.sun.xml.ws.client.Stub in project metro-jax-ws by eclipse-ee4j.
the class WsaServerTube method processResponse.
@Override
@NotNull
public NextAction processResponse(Packet response) {
Message msg = response.getMessage();
if (msg == null) {
return doReturnWith(response);
}
// one way message. Nothing to see here. Move on.
String to = AddressingUtils.getTo(msg.getHeaders(), addressingVersion, soapVersion);
if (to != null) {
replyTo = faultTo = new WSEndpointReference(to, addressingVersion);
}
if (replyTo == null) {
// This is an async response or we're not processing the response in
// the same tube instance as we processed the request. Get the ReplyTo
// now, from the properties we stored into the request packet. We
// assume anyone that interrupted the request->response flow will have
// saved the ReplyTo and put it back into the packet for our use.
replyTo = (WSEndpointReference) response.get(WsaPropertyBag.WSA_REPLYTO_FROM_REQUEST);
}
if (faultTo == null) {
// This is an async response or we're not processing the response in
// the same tube instance as we processed the request. Get the FaultTo
// now, from the properties we stored into the request packet. We
// assume anyone that interrupted the request->response flow will have
// saved the FaultTo and put it back into the packet for our use.
faultTo = (WSEndpointReference) response.get(WsaPropertyBag.WSA_FAULTTO_FROM_REQUEST);
}
WSEndpointReference target = msg.isFault() ? faultTo : replyTo;
if (target == null && response.proxy instanceof Stub) {
target = ((Stub) response.proxy).getWSEndpointReference();
}
if (target == null || target.isAnonymous() || isAnonymousRequired) {
return doReturnWith(response);
}
if (target.isNone()) {
// the caller doesn't want to hear about it, so proceed like one-way
response.setMessage(null);
return doReturnWith(response);
}
if ((wsdlPort != null) && response.getMessage().isOneWay(wsdlPort)) {
// one way message but with replyTo. I believe this is a hack for WS-TX - KK.
LOGGER.fine(AddressingMessages.NON_ANONYMOUS_RESPONSE_ONEWAY());
return doReturnWith(response);
}
// action value.
if (wbo != null || response.soapAction == null) {
String action = response.getMessage().isFault() ? helper.getFaultAction(wbo, response) : helper.getOutputAction(wbo);
// set the SOAPAction, as its got to be same as wsa:Action
if (response.soapAction == null || (action != null && !action.equals(AddressingVersion.UNSET_OUTPUT_ACTION))) {
response.soapAction = action;
}
}
response.expectReply = false;
EndpointAddress adrs;
try {
adrs = new EndpointAddress(URI.create(target.getAddress()));
} catch (NullPointerException | IllegalArgumentException e) {
throw new WebServiceException(e);
}
response.endpointAddress = adrs;
if (response.isAdapterDeliversNonAnonymousResponse) {
return doReturnWith(response);
}
return doReturnWith(NonAnonymousResponseProcessor.getDefault().process(response));
}
Aggregations