Skip to main content

Monitoring SOAP Messages Made Easy With JAX-WS RI 2.0.1

Posted by ramapulavarthi on August 17, 2006 at 10:32 AM PDT

One of the things people want to do while developing Web Services is to look at what the client is sending and receiving. To monitor soap traffic, there are some GUI tools like TCP Monitor and WSMonitor. These monitors are implemented with a 'man in the middle' approach where-in, the monitor listens to a port (Client send requests to this port) and forwards it to another port (Server listens to this port). Since these tools use port forwarding, you need to change your Web Service client to send request to the port where the monitor listens (Especially, if you are using static clients generated by wsimport, the default endpoint address taken from the wsdl needs to be overidden by setting ENDPOINT_ADDRESS_PROPERTY on the proxy).

In JAX-WS 2.0.1, You can monitor the request and response messages without changing the client.
When you invoke the Web Service, just pass the System property "", it prints out the request and response message.

This is the sample request and response, I got by running fromwsdl sample in JAX-WS 2.0.1 M1 bundle by passing this system property.

---[HTTP request]---
Content-Type: text/xml
Accept: text/xml, multipart/related, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
<?xml version="1.0" ?><S:Envelope xmlns:S=""><S:Body><addNumbers xmlns=""><arg0>10</arg0><arg1>20</arg1></addNumbers></S:Body></S:Envelope>--------------------

---[HTTP response 200]---
Date: Thu, 17 Aug 2006 00:35:42 GMT
Content-type: text/xml
Transfer-encoding: chunked
Server: Apache-Coyote/1.1
null: HTTP/1.1 200 OK
<?xml version="1.0" ?><S:Envelope xmlns:S=""><S:Body><addNumbersResponse xmlns=""><return>30</return></addNumbersResponse></S:Body></S:Envelope>--------------------

Jitu explained in his blog, how one can use local transport to test Web Services without deploying the service on to a Web Container. In such case, you can pass "" to monitor SOAP messages.

This can be helpful to just see what the client is sending/receiving to the server very easily. Of course, if you need sophisticated functions like replaying the request, you have to use those monitors.

Try this out yourselves by getting GlassFish 9.1 V2.

Related Topics >>


<p>I'm using v1.12 of jaxws-maven-plugin, which uses JAX-WS ...

I'm using v1.12 of jaxws-maven-plugin, which uses JAX-WS RI 2.1.7-b01-. When passing the "" System property, I do not see the HTTP request in the stdout.Do I need to configure something in the log4j settings or is adding the System property sufficient ?

<p>They changed the package name.&nbsp; ...

They changed the package name. Try:

If I&nbsp;want to see the actual http message raw contents ...

If I want to see the actual http message raw contents going back and forth is there a way to do that? I have an intermitten authentication error (http error code 401) that shows up from time to time and I want to see the actual username and password being exchanged. I'm using new SomeExtendedAuthenticator() ) to provide the user/pass credentials, and a fellow I've worked with says someone else is setting the default authenticator at the time the failure occurrs, and I'm interested in observing what is happening. I'm not sure this is what is happening, but maybe it is...

By the way, using showed the SOAP message and response for me not the package name that included .internal. What version of JAX-WS did this change in?

<p>That solved indeed my problem. Thanks for your help. Do ...

That solved indeed my problem. Thanks for your help. Do you have any idea where I can find the "official" documentation of this change ?