14 Replies Latest reply on Jul 12, 2012 9:38 AM by akayender

    Logging SOAP requests and responses

      What's the easiest way to see what SOAP messages are being exhanged in JBoss 4.0.1? I tried adding an org.apache.axis.handlers.LogHandler to the request and response flows in the global configurations of axis-client-config.xml and axis-server-config.xml, but no dice.

        • 1. Re: Logging SOAP requests and responses
          david.salter

          I use TCPMON (as an IntelliJ plugin).

          You don't need to use this as a plugin, you can use it as a standalone app also. See http://ws.apache.org/axis/java/developers-guide.html

          • 2. Re: Logging SOAP requests and responses

            tcpmon is terrible. I don't want to have to change the port my webservice is deployed to and run an external application just to get some basic log output. What if I need to see what messages are exchanged in a production deployment?

            It turns out that the LogHander does work, but only if a fault is not returned; a fault causes nothing to be logged. That's a pretty woeful implementation...

            • 3. Re: Logging SOAP requests and responses
              thomas.diesler

              The easiest way is to enable debug logging on org.apache.axis like this

               <category name="org.apache.axis">
               <priority value="DEBUG"/>
               </category>
              


              This can also be done at runtime via the Log4JService

              • 4. Re: Logging SOAP requests and responses
                nehring

                One can use ethereal or tcpdump (or any other network sniffer) to capture and look at the SOAP packets on the wire, if that's what you need to do. It can be helpful when working out interop issues related to the SOAP packet structure and you aren't in a situation where soapmon or other proxy tool can be used. The challenge of using a sniffer is setting filters to trap only the packets you're interested in.

                r,
                Lance

                • 5. Re: Logging SOAP requests and responses

                  Thomas: Setting org.apache.axis to DEBUG doesn't print the messages that are being exchanged (incredible!).

                  nehring: Like you say, sniffing isn't very convenient, since there is other HTTP traffic to contend with.

                  I noticed that there is some commented out SOAPMonitor stuff in the config files. Has anyone gotten the SOAPMonitor applet working in JBoss 4?

                  • 6. Re: Logging SOAP requests and responses
                    nehring

                    I've used the SOAPMonitor from the command line, not via the applet. It operates as a proxy like tcpmon where you'll need to point your client to an IP/port that the SOAPMonitor is listening to and configure SOAPMonitor to relay to the packets to the actual SOAP service IP/port. I'm assuming that the applet functions in the same way.

                    Note that you can change either the IP or the port - you don't have to change the port. So you could set your client to talk to a different IP - keeping the port number the same - and have SOAPMonitor listening on that IP/port. Many people forget that you have the whole 127.0.0.0/8 net available on your boxes. I've tried this on Win2K/XP/Linux.

                    For example, the client could be configured to talk to 127.0.0.2/TCP:8080. The SOAPMonitor could be configure to listen on 127.0.0.2/TCP:8080 and talk to a server on 127.0.0.1/TCP:8080. Where the server actually lives on 127.0.0.1/TCP:8080.

                    JBoss can be started with a "-b IP_ADDR" argument that will bind it's services to a specific IP rather than all host interfaces. e.g. "-b 127.0.0.3" will configure JBoss to bind to only IP 127.0.0.3. I noticed log messages about clustering when doing this, but I haven't cared about clustering yet.

                    This gives you some creativity in seting up a testing scenario.

                    r,
                    Lance

                    • 7. Re: Logging SOAP requests and responses
                      thomas.diesler

                       

                      Thomas: Setting org.apache.axis to DEBUG doesn't print the messages that are being exchanged (incredible!).


                      Yes it does, I use it all the time

                      • 8. Re: Logging SOAP requests and responses

                        Ahh, so it does. At first I thought it was only printing the response, and not the request. I must have been blinded by the reams of other output :-) Thanks!

                        • 9. Re: Logging SOAP requests and responses
                          pratik.pai

                          Hi,

                           

                          I want to log Encrypted and Signed Soap Messages.. I tried configuring this in jbosslog4j.xml

                           

                          <category name="org.jboss.ws.core">

                               <priority value="TRACE"/>

                          </category>

                           

                          This just shows the message before encrypting...The message after encryption is not logged...

                           

                          Any help would be highly appreciated!

                           

                          Thanks in Advance!

                           

                          Regards,

                          Pratik Pai

                           

                          “The best way to find yourself is to lose yourself in the service of others.”

                          • 10. Re: Logging SOAP requests and responses
                            spyhunter99

                            depending on what soap stack you're using, you can use some handlers to log the messages, or tcpmon, wireshark or perhaps even fiddler can do this too

                            • 11. Re: Logging SOAP requests and responses
                              pratik.pai

                              1) i am using jbossws native stack

                              2) I tried using some handlers but that dint work..Can you specify the one which will give me the whole encrypted message?

                              3) I tried using TCPMon throws me an error saying the port is already in use

                              • 12. Re: Logging SOAP requests and responses
                                akayender

                                I found this solution and it works fine for me

                                  <category name="org.jboss.ws.core.MessageTrace">

                                    <priority value="TRACE"/>

                                          <appender-ref ref=<appender reference> />

                                   </category>

                                • 13. Re: Logging SOAP requests and responses
                                  pratik.pai

                                  Did it logged your encrypted message??? i Tried that. Infact that was the first thing i tried. That just displays message before encrypting the encrypted message is not Logged.

                                  • 14. Re: Logging SOAP requests and responses
                                    akayender

                                    My ecnription is handled in another server. Sorry to gave you wrogn impression then.