Monday, June 11, 2012

How to take JAX-WS request and response dump

It took me a while to figure out how to see the request and response along with HTTP headers for JAX-WS based clients.

Definitely we can write Handler to log the request/response, but that wont generate the HTTP headers.
The quickest and best way for debugging purpose is to set HttpTransportPipe.dump property.

We can set the following JVM property to see the Request and Response dump while invoking a particular web service using JAX-WS.
The property should be set as,"true"

The dump generated will be outputted to System.out, and it contains The Whole SOAP Request and Response along with HTTP headers.

To set the property go to Run Configuration, select the configuration and then go to the Arguments Tab.

Enter the value in the box marked as  VM Arguments.

Now upon calling web service from your client though eclipse, you should be getting the reqeust and response in the console.