Logging SOAP client messages from CXF in Spring Boot

Since getting this to work was more troublesome that it should have been, here are the details.

First, the following dependencies will be required (I am using 2.7.18):


Next, we need a Spring configuration class that sets up the required CXF classes:

@ImportResource({ "classpath:META-INF/cxf/cxf.xml", "classpath:META-INF/cxf/cxf-extension-soap.xml" })
public class CxfConfig {

	private SpringBus springBus;

	public void activateLoggingFeature() {

	public LoggingFeature loggingFeature() {
    	   LoggingFeature logFeature = new LoggingFeature();
    	   return logFeature;

	public AbstractLoggingInterceptor logInInterceptor() {
	    return new LoggingInInterceptor();

	public AbstractLoggingInterceptor logOutInterceptor() {
		LoggingOutInterceptor logOutInterceptor = new LoggingOutInterceptor();
		return logOutInterceptor;


Finally, we need to add CXF components to the logging framework config (e.g. logback.xml)

   <logger name="org.apache.cxf" level="INFO"/>
ID: 12
Address: ... something ....
Encoding: UTF-8
Http-Method: POST
Content-Type: text/xml
Headers: {Accept=[*/*], SOAPAction=[""]}
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

     ... data here ....



One thought on “Logging SOAP client messages from CXF in Spring Boot

  1. bless you with regard to the particular blog post ive really been searching regarding this kind of information on the web for sum time right now as a result cheers

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s