if (ContextUtils.isOutbound(message)) {
if (usingAddressing(message)) {
// request/response MAPs must be aggregated
aggregate(message, isFault);
}
AddressingProperties theMaps =
ContextUtils.retrieveMAPs(message, false, ContextUtils.isOutbound(message));
if (null != theMaps) {
if (ContextUtils.isRequestor(message)) {
assertAddressing(message,
theMaps.getReplyTo(),
theMaps.getFaultTo());
} else {
checkReplyTo(message, theMaps);
}
}
} else if (!ContextUtils.isRequestor(message)) {
//responder validates incoming MAPs
AddressingProperties maps = getMAPs(message, false, false);
//check responses
if (maps != null) {
checkAddressingResponses(maps.getReplyTo(), maps.getFaultTo());
assertAddressing(message,
maps.getReplyTo(),
maps.getFaultTo());
}
boolean isOneway = message.getExchange().isOneWay();
if (null == maps && !addressingRequired) {
return false;
}
continueProcessing = validateIncomingMAPs(maps, message);
if (maps != null) {
AddressingProperties theMaps =
ContextUtils.retrieveMAPs(message, false, ContextUtils.isOutbound(message));
if (null != theMaps) {
assertAddressing(message, theMaps.getReplyTo(), theMaps.getFaultTo());
}
if (isOneway
|| !ContextUtils.isGenericAddress(maps.getReplyTo())) {
InternalContextUtils.rebaseResponse(maps.getReplyTo(),
maps,
message);
}
if (!isOneway) {
if (ContextUtils.isNoneAddress(maps.getReplyTo())) {
LOG.warning("Detected NONE value in ReplyTo WSA header for request-respone MEP");
} else {
// ensure the inbound MAPs are available in both the full & fault
// response messages (used to determine relatesTo etc.)
ContextUtils.propogateReceivedMAPs(maps,
message.getExchange());
}
}
}
if (continueProcessing) {
// any faults thrown from here on can be correlated with this message
message.put(FaultMode.class, FaultMode.LOGICAL_RUNTIME_FAULT);
} else {
// validation failure => dispatch is aborted, response MAPs
// must be aggregated
//isFault = true;
//aggregate(message, isFault);
if (isSOAP12(message)) {
SoapFault soap12Fault = new SoapFault(ContextUtils.retrieveMAPFaultReason(message),
Soap12.getInstance().getSender());
soap12Fault.setSubCode(new QName(Names.WSA_NAMESPACE_NAME, ContextUtils
.retrieveMAPFaultName(message)));
throw soap12Fault;
}
throw new SoapFault(ContextUtils.retrieveMAPFaultReason(message),
new QName(Names.WSA_NAMESPACE_NAME,
ContextUtils.retrieveMAPFaultName(message)));
}
} else {
AddressingProperties theMaps =
ContextUtils.retrieveMAPs(message, false, ContextUtils.isOutbound(message));
if (null != theMaps) {
assertAddressing(message, theMaps.getReplyTo(), theMaps.getFaultTo());
}
// If the wsa policy is enabled , but the client sets the
// WSAddressingFeature.isAddressingRequired to false , we need to assert all WSA assertion to true
if (!ContextUtils.isOutbound(message) && ContextUtils.isRequestor(message)
&& getWSAddressingFeature(message) != null