Source:
public boolean handleMessage(SOAPMessageContext messageContext) { Boolean outboundProperty = (Boolean) messageContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); try { SOAPMessage oMessage = messageContext.getMessage(); SOAPHeader oHeader = oMessage.getSOAPHeader(); if (outboundProperty) { if (messageContext.containsKey(NhincConstants.ASYNC_MSG_TYPE_PROP) == true) { String msgType = (String) messageContext.get(NhincConstants.ASYNC_MSG_TYPE_PROP); if (msgType.contentEquals(NhincConstants.ASYNC_REQUEST_MSG_TYPE_VAL)) { LOG.debug("Detected an asynchronous request message"); String messageId = null; if (messageContext.containsKey(NhincConstants.ASYNC_MESSAGE_ID_PROP) == true) { messageId = (String) messageContext.get(NhincConstants.ASYNC_MESSAGE_ID_PROP); LOG.debug("Setting message ID to " + messageId); SOAPElement oMessageIdElem = getFirstChild(oHeader, "MessageID", WSA_NS); if (oMessageIdElem != null) { oMessageIdElem.setTextContent(messageId); } } } else if (msgType.contentEquals(NhincConstants.ASYNC_RESPONSE_MSG_TYPE_VAL)) { LOG.debug("Detected an asynchronous response message"); String relatesToId = null; if (messageContext.containsKey(NhincConstants.ASYNC_RELATES_TO_PROP) == true) { relatesToId = (String) messageContext.get(NhincConstants.ASYNC_RELATES_TO_PROP); LOG.debug("Setting relates to ID to " + relatesToId); SOAPElement relatesToElem = oHeader.addChildElement("RelatesTo", WSA_PREFIX, WSA_NS); relatesToElem.setTextContent(relatesToId); } } else { LOG.debug("Detected an synchronous request message"); } } else { LOG.debug("Detected an synchronous request message"); } } else { } } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); } return true; }

Target:
public boolean handleMessage(SOAPMessageContext messageContext) { Boolean outboundProperty = (Boolean) messageContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); try { SOAPMessage oMessage = messageContext.getMessage(); SOAPHeader oHeader = oMessage.getSOAPHeader(); if (outboundProperty) { if (messageContext.containsKey(NhincConstants.ASYNC_MSG_TYPE_PROP) == true) { String msgType = (String) messageContext.get(NhincConstants.ASYNC_MSG_TYPE_PROP); if (msgType.contentEquals(NhincConstants.ASYNC_REQUEST_MSG_TYPE_VAL)) { LOG.debug("Detected an asynchronous request message"); String messageId = null; if (messageContext.containsKey(NhincConstants.ASYNC_MESSAGE_ID_PROP) == true) { messageId = (String) messageContext.get(NhincConstants.ASYNC_MESSAGE_ID_PROP); LOG.debug("Setting message ID to {}", messageId); SOAPElement oMessageIdElem = getFirstChild(oHeader, "MessageID", WSA_NS); if (oMessageIdElem != null) { oMessageIdElem.setTextContent(messageId); } } } else if (msgType.contentEquals(NhincConstants.ASYNC_RESPONSE_MSG_TYPE_VAL)) { LOG.debug("Detected an asynchronous response message"); String relatesToId = null; if (messageContext.containsKey(NhincConstants.ASYNC_RELATES_TO_PROP) == true) { relatesToId = (String) messageContext.get(NhincConstants.ASYNC_RELATES_TO_PROP); LOG.debug("Setting relates to ID to {}", relatesToId); SOAPElement relatesToElem = oHeader.addChildElement("RelatesTo", WSA_PREFIX, WSA_NS); relatesToElem.setTextContent(relatesToId); } } else { LOG.debug("Detected an synchronous request message"); } } else { LOG.debug("Detected an synchronous request message"); } } else { } } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); } return true; }