* @param message the current message
*/
private void assertAddressing(Message message,
EndpointReferenceType replyTo,
EndpointReferenceType faultTo) {
AssertionInfoMap aim = message.get(AssertionInfoMap.class);
if (null == aim) {
return;
}
if (faultTo == null) {
faultTo = replyTo;
}
boolean anonReply = ContextUtils.isGenericAddress(replyTo);
boolean anonFault = ContextUtils.isGenericAddress(faultTo);
boolean onlyAnonymous = anonReply && anonFault;
boolean hasAnonymous = anonReply || anonFault;
QName[] types = new QName[] {
MetadataConstants.ADDRESSING_ASSERTION_QNAME,
MetadataConstants.USING_ADDRESSING_2004_QNAME,
MetadataConstants.USING_ADDRESSING_2005_QNAME,
MetadataConstants.USING_ADDRESSING_2006_QNAME
};
for (QName type : types) {
assertAssertion(aim, type);
if (type.equals(MetadataConstants.ADDRESSING_ASSERTION_QNAME)) {
if (onlyAnonymous) {
assertAssertion(aim, MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME);
} else if (!hasAnonymous) {
assertAssertion(aim, MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME);
}
} else if (type.equals(MetadataConstants.ADDRESSING_ASSERTION_QNAME_0705)) {
if (onlyAnonymous) {
assertAssertion(aim, MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME_0705);
} else if (!hasAnonymous) {
assertAssertion(aim, MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME_0705);
}
}
}
if (!MessageUtils.isRequestor(message) && !MessageUtils.isOutbound(message)) {
//need to throw an appropriate fault for these
Collection<AssertionInfo> aicNonAnon
= aim.getAssertionInfo(MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME);
Collection<AssertionInfo> aicNonAnon2
= aim.getAssertionInfo(MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME_0705);
Collection<AssertionInfo> aicAnon
= aim.getAssertionInfo(MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME);
Collection<AssertionInfo> aicAnon2
= aim.getAssertionInfo(MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME_0705);
boolean hasAnon = (aicAnon != null && !aicAnon.isEmpty())
|| (aicAnon2 != null && !aicAnon2.isEmpty());
boolean hasNonAnon = (aicNonAnon != null && !aicNonAnon.isEmpty())
|| (aicNonAnon2 != null && !aicNonAnon2.isEmpty());