Wednesday, November 17, 2010

Setting Correlation Id in the JMS Service Client with IBM WebSphere 7.0 WSFP

For those who are interested in how to set Correlation Id in SOAP over JMS Service client for IBM WebSphere Web Service Feature Pack it might be set using RequestContext of the Proxy (See below).

According to IBM documentation, transport headers should be set using Constants.REQUEST_TRANSPORT_PROPERTIES as a key name for RequestContext and the value should be a HashMap with name/value pairs for each Transport header, however, if you will try to set JMSCorrelationID property with that HashMap, you will get JMSCC0050 error, as this JMS header property should only be set using the setter method on the Message object (setJMSCorrelationId).

However, the Correlation Id may be set to the RequestContext using JMSConstants.ASYNC_CORRELATION_ID as the key and the the value of the correlation id as the value. Then, the WSFP implementation will set the value on the JMS Message using a setter, as it suppose to be done.

String correlationId = java.util.UUID.randomUUID();
BindingProvider bp = (BindingProvider) port;
bp.getRequestContext().put(JMSConstants.ASYNC_CORRELATION_ID, correlationId);

0 comments: