views:

337

answers:

3

I want to get

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:prin="http://localhost/example&quot;&gt;
   <soapenv:Header/>
   <soapenv:Body>
THIS
   </soapenv:Body>
</soapenv:Envelope>

from webservice request I send from Java.

I use javax.jws

+2  A: 

Set the following VM property:

-Dcom.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump=true
Tal
If you are using JAX-WS libraries baked into JDK 1.6 this will work. If you are using the JAX-RT jars with an earlier JDK you will need to use -Dcom.sun.xml.ws.transport.http.client.HttpTransportPipe.dump=trueThe package names seemed to have changed when the library got baked into the JDK.
Gennadiy
and you need to add jaxws-rt.jar to your project's classpath as well.
Comptrol
+2  A: 

This can be done programmatically (invasive) or by configuration without changing any code. This page documents how to configure JAX-WS RI:

To dump SOAP messages on the client side, use the following system property:

-Dcom.sun.xml.ws.transport.http.client.HttpTransportPipe.dump=true

To dump SOAP messages on the server side, use the following system property:

-Dcom.sun.xml.ws.transport.http.HttpAdapter.dump=true
Pascal Thivent
+1  A: 

Or you can use the man in the middle approach by using a proxy between your client and server like TCPmon or Membrane SOA Monitor. Both are open source under the ASF license. Membrane provides nice XML formatting and highlighting that is especially usful if your SOAP messages are long or complex like messages secured with Web Services Security.

alt text

baranco