Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added more debugging information.

Logging Messages

CXF Servers

CXF includes two logging interceptors which output the incoming/outgoing messages to the Java log. To enable, you need to add these interceptors to your endpoint.

...

Code Block
import javax.xml.ws.Endpoint;
import org.apache.cxf.core.interceptor.LoggingInInterceptor;
import org.apache.cxf.core.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.EndpointImpl;

EndpointImpl ep = (EndpointImpl) Endpoint.publish("http://localhost/service", service);

ep.getServer().getEndpoint().getInInterceptors().add(new LoggingInInterceptor());
ep.getServer().getEndpoint().getOutInterceptors().add(new LoggingOutInterceptor());

CXF Clients

CXF uses Java SE Logging. In the /etc folder of the CXF distribution there is a sample logging.properties file you can use to configure logging. Once done, you will need to set the -Djava.util.logging.config.file property to the location of the logging.properties file. As an example, the Ant target below has this property set:

Code Block
xml
xml

<target name="runClient">
   <java classname="client.WSClient" fork="true">	    	
      <classpath>
         <pathelement location="${build.classes.dir}"/>
         <fileset dir="${env.CXF_HOME}/lib">
            <include name="*.jar"/>
         </fileset>
      </classpath>
      <jvmarg value="-Djava.util.logging.config.file=/usr/myclientapp/logging.properties"/>
   </java>
</target>

Debugging Tools

Tcpmon

TCPMon can be downloaded here and allows you to easily view messages as they go back and forth on the wire.

WSMonitor

WSMonitor has slightly more functionality than Tcpmon. Information on how to reconfigure clients to work with WSMonitor is available here.

SOAP UI

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 plugins for Eclipse/, IDEA pluginsand NetBeans.