messageInformationHeaders = new MessageInformationHeaders();
}
Iterator addressingHeadersIt = addressingHeaders.iterator();
while (addressingHeadersIt.hasNext()) {
SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock) addressingHeadersIt.next();
EndpointReference epr = null;
if (AddressingConstants.WSA_TO.equals(soapHeaderBlock.getLocalName())) {
//here the addressing epr overidde what ever already there is
epr = new EndpointReference(soapHeaderBlock.getText());
messageInformationHeaders.setTo(epr);
soapHeaderBlock.setProcessed();
} else if (AddressingConstants.WSA_FROM.equals(soapHeaderBlock.getLocalName())) {
epr = messageInformationHeaders.getFrom();
if (epr == null) {
epr = new EndpointReference("");
messageInformationHeaders.setFrom(epr);
}
extractEPRInformation(soapHeaderBlock, epr, addressingNamespace);
soapHeaderBlock.setProcessed();
} else if (AddressingConstants.WSA_REPLY_TO.equals(soapHeaderBlock.getLocalName())) {
epr = messageInformationHeaders.getReplyTo();
if (epr == null) {
epr = new EndpointReference("");
messageInformationHeaders.setReplyTo(epr);
}
extractEPRInformation(soapHeaderBlock, epr, addressingNamespace);
soapHeaderBlock.setProcessed();
} else if (AddressingConstants.WSA_FAULT_TO.equals(soapHeaderBlock.getLocalName())) {
epr = messageInformationHeaders.getFaultTo();
if (epr == null) {
epr = new EndpointReference("");
messageInformationHeaders.setFaultTo(epr);
}
extractEPRInformation(soapHeaderBlock, epr, addressingNamespace);
soapHeaderBlock.setProcessed();
} else if (AddressingConstants.WSA_MESSAGE_ID.equals(soapHeaderBlock.getLocalName())) {
messageInformationHeaders.setMessageId(soapHeaderBlock.getText());
soapHeaderBlock.setProcessed();
} else if (AddressingConstants.WSA_ACTION.equals(soapHeaderBlock.getLocalName())) {
messageInformationHeaders.setAction(soapHeaderBlock.getText());
soapHeaderBlock.setProcessed();
} else if (AddressingConstants.WSA_RELATES_TO.equals(soapHeaderBlock.getLocalName())) {
String address = soapHeaderBlock.getText();
OMAttribute relationshipType =
soapHeaderBlock.getFirstAttribute(
new QName(AddressingConstants.WSA_RELATES_TO_RELATIONSHIP_TYPE));
String relationshipTypeDefaultValue =
Submission.WSA_NAMESPACE.equals(addressingNamespace)
? Submission.WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE
: Final.WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE;
RelatesTo relatesTo =
new RelatesTo(
address,
relationshipType == null
? relationshipTypeDefaultValue
: relationshipType.getValue());
messageInformationHeaders.setRelatesTo(relatesTo);
soapHeaderBlock.setProcessed();
}
}
return messageInformationHeaders;