use of com.sun.xml.ws.message.FaultDetailHeader in project metro-jax-ws by eclipse-ee4j.
the class WsaServerTube method processRequest.
@Override
@NotNull
public NextAction processRequest(Packet request) {
Message msg = request.getMessage();
if (msg == null) {
return doInvoke(next, request);
}
// hmm?
// expose bunch of addressing related properties for advanced applications
request.addSatellite(new WsaPropertyBag(addressingVersion, soapVersion, request));
// Store request ReplyTo and FaultTo in requestPacket.invocationProperties
// so that they can be used after responsePacket is received.
// These properties are used if a fault is thrown from the subsequent Pipe/Tubes.
MessageHeaders hl = request.getMessage().getHeaders();
String msgId;
try {
replyTo = AddressingUtils.getReplyTo(hl, addressingVersion, soapVersion);
faultTo = AddressingUtils.getFaultTo(hl, addressingVersion, soapVersion);
msgId = AddressingUtils.getMessageID(hl, addressingVersion, soapVersion);
} catch (InvalidAddressingHeaderException e) {
LOGGER.log(Level.WARNING, addressingVersion.getInvalidMapText() + ", Problem header:" + e.getProblemHeader() + ", Reason: " + e.getSubsubcode(), e);
// problematic header must be removed since it can fail during Fault message processing
hl.remove(e.getProblemHeader());
SOAPFault soapFault = helper.createInvalidAddressingHeaderFault(e, addressingVersion);
// WS-A fault processing for one-way methods
if ((wsdlPort != null) && request.getMessage().isOneWay(wsdlPort)) {
Packet response = request.createServerResponse(null, wsdlPort, null, binding);
return doReturnWith(response);
}
Message m = Messages.create(soapFault);
if (soapVersion == SOAPVersion.SOAP_11) {
FaultDetailHeader s11FaultDetailHeader = new FaultDetailHeader(addressingVersion, addressingVersion.problemHeaderQNameTag.getLocalPart(), e.getProblemHeader());
m.getHeaders().add(s11FaultDetailHeader);
}
Packet response = request.createServerResponse(m, wsdlPort, null, binding);
return doReturnWith(response);
}
// defaulting
if (replyTo == null) {
replyTo = addressingVersion.anonymousEpr;
}
if (faultTo == null) {
faultTo = replyTo;
}
// Save a copy into the packet such that we can save it with that
// packet if we're going to deliver the response at a later time
// (async from the request).
request.put(WsaPropertyBag.WSA_REPLYTO_FROM_REQUEST, replyTo);
request.put(WsaPropertyBag.WSA_FAULTTO_FROM_REQUEST, faultTo);
request.put(WsaPropertyBag.WSA_MSGID_FROM_REQUEST, msgId);
wbo = getWSDLBoundOperation(request);
isAnonymousRequired = isAnonymousRequired(wbo);
Packet p = validateInboundHeaders(request);
// then do no further processing
if (p.getMessage() == null) {
return doReturnWith(p);
}
// if we find an error in addressing header, just turn around the direction here
if (p.getMessage().isFault()) {
// we'll never use them
if (isEarlyBackchannelCloseAllowed && !(isAnonymousRequired) && !faultTo.isAnonymous() && request.transportBackChannel != null) {
request.transportBackChannel.close();
}
return processResponse(p);
}
// we'll never use them
if (isEarlyBackchannelCloseAllowed && !(isAnonymousRequired) && !replyTo.isAnonymous() && !faultTo.isAnonymous() && request.transportBackChannel != null) {
request.transportBackChannel.close();
}
return doInvoke(next, p);
}
use of com.sun.xml.ws.message.FaultDetailHeader in project metro-jax-ws by eclipse-ee4j.
the class WsaTube method validateInboundHeaders.
/**
* Validates the inbound message. If an error is found, create
* a fault message and returns that. Otherwise
* it will pass through the parameter 'packet' object to the return value.
*/
protected Packet validateInboundHeaders(Packet packet) {
SOAPFault soapFault;
FaultDetailHeader s11FaultDetailHeader;
try {
checkMessageAddressingProperties(packet);
return packet;
} catch (InvalidAddressingHeaderException e) {
LOGGER.log(Level.WARNING, addressingVersion.getInvalidMapText() + ", Problem header:" + e.getProblemHeader() + ", Reason: " + e.getSubsubcode(), e);
soapFault = helper.createInvalidAddressingHeaderFault(e, addressingVersion);
s11FaultDetailHeader = new FaultDetailHeader(addressingVersion, addressingVersion.problemHeaderQNameTag.getLocalPart(), e.getProblemHeader());
} catch (MissingAddressingHeaderException e) {
LOGGER.log(Level.WARNING, addressingVersion.getMapRequiredText() + ", Problem header:" + e.getMissingHeaderQName(), e);
soapFault = helper.newMapRequiredFault(e);
s11FaultDetailHeader = new FaultDetailHeader(addressingVersion, addressingVersion.problemHeaderQNameTag.getLocalPart(), e.getMissingHeaderQName());
}
if (soapFault != null) {
// WS-A fault processing for one-way methods
if ((wsdlPort != null) && packet.getMessage().isOneWay(wsdlPort)) {
return packet.createServerResponse(null, wsdlPort, null, binding);
}
Message m = Messages.create(soapFault);
if (soapVersion == SOAPVersion.SOAP_11) {
m.getHeaders().add(s11FaultDetailHeader);
}
return packet.createServerResponse(m, wsdlPort, null, binding);
}
return packet;
}
Aggregations