Hi,

1. Set own ID for message
You need following code on service side, in your service implementation:

   @Resource
   private WebServiceContext wsContext;

  ...
  AddressingBuilder builder = AddressingBuilder.getAddressingBuilder();
  AddressingProperties maps = builder.newAddressingProperties();
  AttributedURIType messageID = WSA_OBJECT_FACTORY.createAttributedURIType();
  messageID.setValue(__YOUR_CUSTOM_MESSAGE_ID__);
  maps.setMessageID(messageID);
  
wsContext.getMessageContext().put(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND,
 maps);
 ...

2. Retrieve generated ID
CXF generates message id in MAPAggregatorImpl.java interceptor 
(assembleGeneric() method ) using ContextUtils.generateUUID().
You can retrieve it using own interceptor invoked after MAPAggregator on 
Phase.PRE_LOGICAL.
To retrieve message id you can use ContextUtils.retrieveMAPs() method:

   AddressingProperties theMaps = ContextUtils.retrieveMAPs(message, false, 
true); 
   String messageID = theMAPs.getMessageID();

Regards,
Andrei.

-----Original Message-----
From: kongar [mailto:[email protected]] 
Sent: Samstag, 6. Oktober 2012 02:43
To: [email protected]
Subject: How do I set or get the Ws-Addressing MessageId of a Response?

Hullo,

Is there a way for me to set the message id for a response message?  And for 
the case of CXF generating it, is there a way to retrieve it?

Thanks!



--
View this message in context: 
http://cxf.547215.n5.nabble.com/How-do-I-set-or-get-the-Ws-Addressing-MessageId-of-a-Response-tp5715884.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to