8

I know it is possible to use Eclipse TCP/IP monitoring to trace SOAP messages. I tried that but it is not able to monitor my localhost. TCP/IP does not show the localhost in its console.

I can access the application through http://localhost:8080/MyApp/ In TCP/IP configuration I have following

Local monitoring port 9090 (a random port that I have chosen)
Host name: localhost
Port: 8080
Type: TCP/IP
Timeout:0

Is there any way to solve the issue with TCP/IP or find any alternative software?

Jack
  • 6,430
  • 27
  • 80
  • 151
  • 1
    set trace level logging for `org.springframework.ws.client.MessageTracing`. – M. Deinum Aug 25 '15 at 11:33
  • I would go with Wireshark as it's an absolutely incredible tool to debug SOAP. You capture packets, type `http` into filter field to only show http requests/responses(you can specify src or dst and zillion of options) - right click on the list item -> 'Follow TCP Stream'. Or use one of the plugins. – Boris Treukhov Sep 18 '15 at 22:10

4 Answers4

5

EDIT: Wireshark is one of the most comprehensive software for this (but its a little involved)

I have used, Fiddler and Charlesproxy, for the same - WebSvcs, Rest, SOAP (after having failed miserably in Eclipse tools). Both of them, are much superior to eclipse and very easy to use.

Here is the way you setup fiddler-

  1. Download and start fiddler.
  2. Add following VM Options in Eclipse preferences

    DproxySet=true -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=8888

  3. Optionally, you may also setup programatically

    System.setProperty("http.proxyHost", "127.0.0.1"); System.setProperty("https.proxyHost", "127.0.0.1"); System.setProperty("http.proxyPort", "8888"); System.setProperty("https.proxyPort", "8888");

  4. Restart your application.(I never needed to restart eclipse itself, but eclipse, sometime has a mind of its own)

Thats it, this is the most common and basic setup, useful for 90% of usecases, I have dealt with. Note: Fiddler listens by default on 8888 port.

There is further setup, if your server uses SSL/certs. Here is the link to full documentation.

Note: There is much content, even on stackoverflow on these setup, should you get stuck.

Also, Charlesproxy is also really good, but I have personally used fiddler mostly for Webservice client development.

eXc
  • 171
  • 4
  • I used wireshark but I was overwhelmed with number of HTTP messages that it showed. – Jack Sep 17 '15 at 01:36
  • I know, that's why I don't recommend that as a first choice. But it is extremely powerful, and once you get a hang of it, you probably don't need any other tool. Did you try fiddler yet? – eXc Sep 17 '15 at 14:21
4

Perhaps instead of using the Eclipse TCP/IP monitoring you would prefer to enable the built in Spring logging? In that case you can enable logging on the DEBUG or TRACE level for

  • org.springframework.ws.client.MessageTracing if you want to log on the client side
  • org.springframework.ws.server.MessageTracing if you want to log on the server level

On the DEBUG level, only the payload root element is logged; on the TRACE level, the entire message content. See Spring documentation for details and a Log4J configuration sample.

Alternatively, you may configure a PayloadLoggingInterceptor or SoapEnvelopeLoggingInterceptor. In beans.xml you can do that like this:

<sws:interceptors>
    <bean class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor"/>
</sws:interceptors>

More on that solution here (section 5.5.2.1)

Note that Spring uses Commons-Logging facade for logging, so you need an actual logging framework to see the logs, eg. Log4J.

Adam Michalik
  • 9,678
  • 13
  • 71
  • 102
2

It is possible to log SOAP message from the client side by enabling the following system properties:

System.setProperty("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", "true");
System.setProperty("com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump", "true");
System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true");
System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump", "true");

Reference:

Tracing XML request/responses with JAX-WS when error occurs

Community
  • 1
  • 1
Salman
  • 1,236
  • 5
  • 30
  • 59
1

You can use wireshark with loopback enabled and add http as a filter. Which will serve your purpose

Abhay Pore
  • 75
  • 8