Chapter 12.  SOAP Message Logging

The cxf-extension-jbossws.xml file contains the JBossWS extensions to the Apache CXF stack. You need to manually add this file and link it in the cxf.extensions file. In cxf-extension-jbossws-xml you need to enable:
      <ref bean="logInbound"/>
      <ref bean="logOutbound"/>
      <ref bean="logOutbound"/>
Once you've uncommented the cxf-extension-jbossws.xml contents, you need to re-pack the jar or zip. Alternatively, Apache CXF offers multiple ways of configuring SOAP message logging; for programmatic configuration, the below annotations can be used on either the SEI or the SEI implementation class. If placed on the SEI, they activate logging both for client and server; if on the SEI implementation class, they are relevant just for server-side logging.
@javax.jws.WebService(portName = "MyWebServicePort", serviceName = "MyWebService", ...)
@Features(features = "org.apache.cxf.feature.LoggingFeature")        
public class MyWebServicePortTypeImpl implements MyWebServicePortType {

Or equivalent:
import org.apache.cxf.interceptor.InInterceptors;
import org.apache.cxf.interceptor.OutInterceptors;

@javax.jws.WebService(portName = "WebServicePort", serviceName = "WebServiceService", ...)
@InInterceptors(interceptors = "org.apache.cxf.interceptor.LoggingInInterceptor")
@OutInterceptors(interceptors = "org.apache.cxf.interceptor.LoggingOutInterceptor")
public class WebServicePortTypeImpl implements WebServicePortType {
For programmatic client-side logging, the following code snippet can be used as an example:
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;

public class WSClient {
    public static void main (String[] args) {
        MyService ws = new MyService();
        MyPortType port = ws.getPort();
        Client client = ClientProxy.getClient(port);
        client.getInInterceptors().add(new LoggingInInterceptor());
        client.getOutInterceptors().add(new LoggingOutInterceptor()); 
        // make WS calls...
Finally, you can also enable message logging using the Logging feature.
<beans xmlns=""


12.1.  Debugging Tools

Here is a list of tools that can be used to capture exchanged messages:
TCPMon allows you to easily view messages as they go back and forth on the wire.
WSMonitor is another option to Tcpmon with slightly more functionality.
SOAP UI can also be used for debugging. In addition to viewing messages, it allows you send messages and load test your services. It also has plug-ins for Eclipse, IDEA and NetBeans.
Wireshark, a network packet analyzer, is useful for following the routing of SOAP messages. It can also help when you are getting an HTML error message from the server that your CXF client cannot normally process, by allowing you to see the non-SOAP error message.