Monitoring SOAP messages with TCPMon and a JAX-WS client
When you create a JAX-WS client for a Web Service, you may encounter troubles to monitor the SOAP messages that transit between the client and the service.
Indeed, this is how JAX-WS proceeds:
- The client knows the URL of the WSDL (in the class which is annotated with @WebServiceClient).
- So, first, the client retrieves the WSDL document and finds the service’s end-point in it.
- The service is directly invoked.
In terms of exchanges, it means:
- Client to WSDL URL: a HTTP GET is sent and the WSDL content is returned
- Client to the service URL: a HTTP POST is sent, containing the SOAP message, and the SOAP response is returned.
There are two ways of placing TCPMon between the client and the Web service.
Each approach leads to a different result.
If you only update the port of the WSDL URL that is described in the client, then you will only see the HTTP GET request.
This is the one that returns the WSDL content from the URL. But you will not see the SOAP messages with this approach.
The solution to watch them, is to use a modified WSDL.
And this WSDL must force the client to go through TCPMon.
- Save the WSDL file in another location.
- In this second WSDL, update the port in the service’s end-point to use the TCPmon one.
- Update the port in the WSDL URL, that is described in the client.
Then, all the requests (GET and SOAP messages) will go though TCPMon.