Apache CXF 2.0 Documentation > Index > Simple Frontend

CXF includes a simple frontend which builds services from reflection. This is in contrast to the JAX-WS frontend which requires you to annotate your services. The simple frontend will use reflection to intelligently map your classes to a WSDL model.

By default CXF uses the JAXB databinding. If you are interested in a databinding which does not require annotations, please see the documentation on the Aegis Databinding.


The ServerFactoryBean produces a Server instance for you. It requires a service class and an address to publish the service on. By creating a Server you'll have started your service and made it available to the outside world.

First you'll want to create your service class:

public interface Hello {
  String sayHello();

This does not have to be an interface, but we're going to use an interface for this example because

  1. It is good to separate out your service contract (your interface) from your implementation
  2. This allows us to easily create a Java Proxy client

We'll also need an implementation class:

public interface HelloImpl {
  public String sayHello() {
    return "hello";

And now we'll want to create a Server from this

import org.apache.cxf.frontend.ServerFactoryBean;

// Create our service implementation
HelloWorldImpl helloWorldImpl = new HelloWorldImpl();

// Create our Server
ServerFactoryBean svrFactory = new ServerFactoryBean();
svrFactory.setInvoker(new BeanInvoker(helloWorldImpl);

Your service is now started! You can access the wsdl at "http://localhost:8080/Hello?wsdl".


You'll also want to create a client for your service. CXF includes a ClientProxyFactoryBean which will create a Java proxy for you from your interface which will invoke the service.

import org.apache.cxf.frontend.ClientProxyFactoryBean;

ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
Hello client = (Hello) factory.create();

You simply need to set your service class and your service's URL on the bean. Calling create() will then create a proxy for you based on your interface.