code: public static void writeCorrelationId(Message message, String correlationId) {
          if (!(message instanceof SoapMessage)) {
              return;
          }
          SoapMessage soapMessage = (SoapMessage) message;
          Header hdCorrelationId = soapMessage.getHeader(CORRELATION_ID_QNAME);
          if (hdCorrelationId != null) {
              LOG.warning("CorrelationId already existing in soap header, need not to write CorrelationId header.");
              return;
          }
          if ((soapMessage.getContent(javax.xml.stream.XMLStreamWriter.class) != null)
                  && (soapMessage.getContent(javax.xml.stream.XMLStreamWriter.class) instanceof SAAJStreamWriter)
                  && (((SAAJStreamWriter) soapMessage.getContent(javax.xml.stream.XMLStreamWriter.class))
                          .getDocument()
                          .getElementsByTagNameNS("http://www.talend.com/esb/sam/correlationId/v1",
                                  "correlationId").getLength() > 0)) {
              LOG.warning("CorrelationId already existing in soap header, need not to write CorrelationId header.");
              return;
          }
  
          try {
              soapMessage.getHeaders().add(
                      new Header(CORRELATION_ID_QNAME, correlationId, new JAXBDataBinding(String.class)));
              if (LOG.isLoggable(Level.FINE)) {
                  LOG.fine("Stored correlationId '" + correlationId + "' in soap header: "
                          + CORRELATION_ID_QNAME);
              }
          } catch (JAXBException e) {
              LOG.log(Level.SEVERE, "Couldn't create correlationId header.", e);
          }
  
      }
docs: Write correlation id to message.
  
  @param message the message
  @param correlationId the correlation id