if (event == null)
{
return;
}
MuleSoapHeaders muleHeaders = new MuleSoapHeaders(event);
if (muleHeaders.getCorrelationId() == null && muleHeaders.getReplyTo() == null)
{
return;
}
Document owner_doc = DOMUtils.createDocument();
Element mule_header = owner_doc.createElementNS(MULE_NS_URI, QUALIFIED_MULE_HEADER);
// setup mule: namespace prefix declaration so that we can use it.
mule_header.setAttribute("xmlns:mule", MULE_NS_URI);
if (muleHeaders.getCorrelationId() != null)
{
mule_header.appendChild(buildMuleHeader(owner_doc, MULE_CORRELATION_ID_PROPERTY,
muleHeaders.getCorrelationId()));
mule_header.appendChild(buildMuleHeader(owner_doc, MULE_CORRELATION_GROUP_SIZE_PROPERTY,
muleHeaders.getCorrelationGroup()));
mule_header.appendChild(buildMuleHeader(owner_doc, MULE_CORRELATION_SEQUENCE_PROPERTY,
muleHeaders.getCorrelationSequence()));
}
if (muleHeaders.getReplyTo() != null)
{
mule_header.appendChild(buildMuleHeader(owner_doc, MULE_REPLY_TO_PROPERTY,
muleHeaders.getReplyTo()));
}
SoapHeader sh = new SoapHeader(new QName(MULE_NS_URI, MULE_HEADER), mule_header);
message.getHeaders().add(sh);
}