Java Reference
In-Depth Information
Monitoring SOAP Traffic with Metro
Problem
You're using Glassfish/Metro and you want to dump the transport-level traffic that your web
service client sends and receives to the console.
Solution
Pass
the
flag
-
Dcom.sun.xml.ws.transport.http.client.HttpTransportPipe.dump=true to
your
JVM.
This dump technique shows you the bytes representing the message as it is sent and received
on the wire. That means that you also get transport-specific information, such as all HTTP
headers, which can be useful.
You can also do this in Ant with jvmarg :
<target name="run">
<java classname="com.soacookbook.ch03.MyClient"
fork="true">
<arg value="someArg"/>
<classpath>
<path refid="jaxws.classpath"/>
<pathelement location="..."/>
</classpath>
<jvmarg
value="-Dcom.sun.xml.ws.transport.http.client.HttpTransportPipe.dump=
true"/>
</java>
</target>
Note that the JUnit Ant task will accept the jvmarg element too, so you can easily add it to
invocations that you test on your client as well. See Example 4-5 .
Example4-5.JUnit Ant task with SOAP message dumping enabled
<target name="run-test" depends="compile-test">
<echo message="-----Running Tests-----" />
<junit fork="true" printsummary="true"
errorProperty="test.failed"
failureProperty="test.failed">
<classpath refid="cp.test" />
Search WWH ::




Custom Search