How to debug Web Services

User Rating: 4 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Inactive
 
In this tutorial we will see how you can debug your JBoss Web Services applications by using some built-in logging features or using an external TCP dumper.
Debbugging SOAP Messages is a critical activity for every application running Web Services.The simplest way to see the full SOAP messages returned by JBoss or WildFly is to add this System Property to your server which will print the incoming and outgoing SOAP XML Messages:
<system-properties>
        <property name="org.apache.cxf.logging.enabled" value="true"/>
</system-properties>  

Another alternative can be monitoring your Web Service Port using an external tool. We have tested Apache TCPMon which is a valuable tool for monitoring your network applications.

Download here the lastest stable release of it:
http://archive.apache.org/dist/ws/tcpmon/

Launch the main Program in build/tcpmon.cmd

Configuring the Monitor is pretty easy. For our purpose we need to intercept Web Service request before they reach the Server and as well we need to capture response before they reach the client.

In the Admin tab select a Listening port for Apache TCPMon and a target port which corresponds to JBoss AS listening port. For example:

jboss web services debug tcpmon 
Now modify your Web Services client so that they point to the Apache TCPMon Port instead of JBoss. For example:
 public static void main(String args[]) throws Exception {   
 String endpointURI ="http://127.0.0.1:8888/ejb/HelloWorld?wsdl";   
 String helloWorld = "Hello world!";   
 
 Object retObj = getPort(endpointURI).echo(helloWorld);   
 System.out.println(retObj);   
 }   
In the meantime, you will find the outcomign and incoming SOAP Messages in the TCPMon Console:
TCPMon is a simple and easy to use tool that has many benefits when developing message driven applications. It is particularly useful in developing Web services.
For additional information about it, check:
https://ws.apache.org/tcpmon/tcpmontutorial.html

Related articles available on mastertheboss.com

JBoss web services

JAX-WS simplifies the development model for a web service endpoin

What is a Web Service One Way invocation?

JBoss recipe of the day

Asynchronous web services with JBoss WS

Developing rigorous and responsive web service client application

How to change the default Web Service deployment Port ?

JBoss recipe of the day

Using Axis Web Services with JBoss

Still not ready for JBoss WS ? if you don't have a JDK 1.5 compli

Invoking JBoss Web Services with Flex

Flex® is a free, open source framework for building highly in