Map alreadyFoundAddrHeader = new HashMap(7); // there are seven frequently used WS-A headers
// First pass just check for duplicates
Iterator addressingHeadersIt = addressingHeaders.iterator();
while (addressingHeadersIt.hasNext()) {
SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock) addressingHeadersIt.next();
if (SOAP12Constants.SOAP_ROLE_NONE.equals(soapHeaderBlock.getRole()))
continue;
if (WSA_TO.equals(soapHeaderBlock.getLocalName())) {
checkDuplicateHeaders(WSA_TO, messageContext, alreadyFoundAddrHeader);
} else if (WSA_FROM.equals(soapHeaderBlock.getLocalName())) {
checkDuplicateHeaders(WSA_FROM, messageContext, alreadyFoundAddrHeader);
} else if (WSA_REPLY_TO.equals(soapHeaderBlock.getLocalName())) {
checkDuplicateHeaders(WSA_REPLY_TO, messageContext, alreadyFoundAddrHeader);
} else if (WSA_FAULT_TO.equals(soapHeaderBlock.getLocalName())) {
checkDuplicateHeaders(WSA_FAULT_TO, messageContext, alreadyFoundAddrHeader);
} else if (WSA_MESSAGE_ID.equals(soapHeaderBlock.getLocalName())) {
checkDuplicateHeaders(WSA_MESSAGE_ID, messageContext, alreadyFoundAddrHeader);
} else if (WSA_ACTION.equals(soapHeaderBlock.getLocalName())) {
checkDuplicateHeaders(WSA_ACTION, messageContext, alreadyFoundAddrHeader);
} else if (WSA_RELATES_TO.equals(soapHeaderBlock.getLocalName())) {
checkDuplicateHeaders(WSA_RELATES_TO, messageContext, alreadyFoundAddrHeader);
}
}
// Now extract information
Iterator addressingHeadersIt2 = addressingHeaders.iterator();
while (addressingHeadersIt2.hasNext()) {
SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock) addressingHeadersIt2.next();
if (SOAP12Constants.SOAP_ROLE_NONE.equals(soapHeaderBlock.getRole()))
continue;
if (WSA_TO.equals(soapHeaderBlock.getLocalName())) {
extractToEPRInformation(soapHeaderBlock, messageContextOptions, header);
} else if (WSA_FROM.equals(soapHeaderBlock.getLocalName())) {
extractFromEPRInformation(messageContextOptions, soapHeaderBlock, addressingNamespace);
} else if (WSA_REPLY_TO.equals(soapHeaderBlock.getLocalName())) {
extractReplyToEPRInformation(messageContextOptions, soapHeaderBlock, addressingNamespace);
} else if (WSA_FAULT_TO.equals(soapHeaderBlock.getLocalName())) {
extractFaultToEPRInformation(messageContextOptions, soapHeaderBlock, addressingNamespace);
} else if (WSA_MESSAGE_ID.equals(soapHeaderBlock.getLocalName())) {
messageContextOptions.setMessageId(soapHeaderBlock.getText());
soapHeaderBlock.setProcessed();
} else if (WSA_ACTION.equals(soapHeaderBlock.getLocalName())) {
messageContextOptions.setAction(soapHeaderBlock.getText());
soapHeaderBlock.setProcessed();
} else if (WSA_RELATES_TO.equals(soapHeaderBlock.getLocalName())) {
extractRelatesToInformation(soapHeaderBlock, addressingNamespace, messageContextOptions);
}
}
// check for the presense of madatory addressing headers