code: private String getMessageId(Message message) {
          String messageId = null;
  
          AddressingProperties addrProp = ContextUtils.retrieveMAPs(message, false,
                  MessageUtils.isOutbound(message));
          if (addrProp != null && addrProp.getMessageID() != null) {
              messageId = addrProp.getMessageID().getValue();
          }
  
          return messageId;
      }
docs: Get MessageId string.
  if enforceMessageIDTransfer=true or WS-Addressing enabled explicitly (i.e with <wsa:addressing/> feature),
  then MessageId is not null and conform with the definition in the WS-Addressing Spec;
  if enforceMessageIDTransfer=false and WS-Addressing doesn't enable,
  then MessageId is null.
  @param message the message
  @return the message id