CXF is a web service framework for java. We've successfully developed clients (consumers) and services using it. The official website is at


Interceptors can listen to incoming or outgoing messages. The CXF library can be used as both client and server, so an outgoing message from a client may be considered in incoming message on the server.

AbstractPhaseInterceptor is the base class, handleMessage() must be implemented, and optionally handleFault() can be overridden. If there is a fault, then inside handleFault(), you can access details via

Exception exception = message.getContent(Exception.class);
Throwable cause = exception.getCause();

An example of an interceptor is a custom logger.

The phase must be chosen as part of the interceptor's construction. Look at the Phase class for a valid phase name, and refer to CXF Interceptors documentation for a description of the various phases.

Request and response objects

Get a handle on the request or response objects using the following snippet:


a maybe used for objects used for both request and response.

Published: Wednesday, 9 June 2010
Updated: Thursday, 12 March 2015