CXF has four primary classes which help in the representation of services:




The Service contains the service model, which is an abstract representation of the Service and its operations. It also contains information such as the databinding being used, the Invoker, the Executor, service properties, interceptors, and more.


The Endpoint represents an endpoint which can receive messages. Its primary function is to hold Interceptors which are specific to that endpoint (for instance, SOAP interceptors) and provide listeners for faults that occur. Both the Client and Server use the Endpoint class.


The Client is a client implementation which manages message flows on the client side.


The Server represents a Server endpoint inside CXF. It provides hooks to start/stop the server and access the Endpoint.

CXF also includes several factories to assist in the creation of clients and servers:





This class is responsible for creating the service model from either a WSDL or a class file. It also sets up basic properties such as the databinding or basic interceptors. It is most often hidden behind a Client/ServerFactoryBean.

ReflectionServiceFactoryBean, JaxWsServiceFactoryBean


Creates a Server side endpoint.

ServerFactoryBean, JaxWsServerFactoryBean


Creates a Client endpoint.

ClientFactoryBean, JaxWsClientFactoryBean


Creates a Java proxy around a Client

ClientProxyFactoryBean, JaxWsProxyFactoryBean

For more information on how to use these beans, please see the Simple Frontend page or the javadocs.

ServiceFactoryBeans and AbstractServiceConfiguration

The primary service factory bean inside CXF is the ReflectionServiceFactoryBean. It provides a way to map a class to a service. If you are interested in controlling how this mapping occurs, you can extend and provide your own Service configuration. Most configuration of services happens through these. For instance, in the JAX-WS frontend, the JaxWsServiceConfiguration controls how the service is mapped by inspecting the JAX-WS annotations.

To add your own service configuration:

MyServiceConfiguration config = new AbstractServiceConfiguration() {
... // your implementation
ReflectionServiceFactoryBean serviceFactory = new ReflectionServiceFactoryBean();
serviceFactory.getServiceConfigurations().add(0, config);

ServerFactoryBean svrFactory = new ServerFactoryBean();
Server svr = svrFactory.create();
  • No labels