Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jax WS - correlate request and response in a soap handler

 
Cristian Popovici
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Is there a way to correlate the request and response from a service call in a soap handler?
I am storing the request and respose soap messages (xml fragments) in a database for logging purposes and I need to track the pairs (request, response).

Regards,
Cristi.
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
I'll try to describe a model that will let you correlate requests and responses from a web service client. It includes making modifications to both the client and the web service itself.

Web Service Client
In the client, before sending the request, insert a correlation id for the request into the MessageContext of the request.
In the client handler, retrieve the correlation id from the MessageContext and insert into a header with the ultimate receiver as actor (SOAP 1.1)/role (SOAP 1.2).

When the client receives a response, the handler retrieves the appropriate header block containing the correlation id and inserts it into the MessageContext of the response.
The code in the client can then retrieve the correlation id from the MessageContext.

Web Service Server
In the web service, another handler retrieves the header block containing the correlation id and inserts it into the MessageContext of the received request.
The service may then retrieve the correlation id and set set it in the response.
Again, the handler copies the information from the MessageContext of the outgoing response to the appropriate header block.

Perhaps there are steps in the above that you do not need. Such steps can, of course, be removed.
Further inspiration can be found in, for instance, an implementation of WS-ReliableMessaging.
Best wishes!
 
H Paul
Ranch Hand
Posts: 471
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The steps described above is similar to the use case of JMS correlation id in the context of JMS Message.
(JMS correlation id for Request/Reply model where it involves 2 parties: Client/Consumer and Server/Provider.)


OP,

Can you re-clarify your question? Does your process involve only the server side? or client side or both end?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic