Overview
CXF has four primary classes which help in the representation of services:
...
Class | Function | Implementations |
---|---|---|
AbstractServiceFactoryBean | 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 |
ServerFactoryBean | Creates a Server side endpoint. | ServerFactoryBean, JaxWsServerFactoryBean |
ClientFactoryBean | Creates a Client endpoint. | ClientFactoryBean, JaxWsClientFactoryBean |
ClientProxyFactoryBean | Creates a Java proxy around a Client | ClientProxyFactoryBean, JaxWsProxyFactoryBean |
ServerFactoryBeans
ClientFactoryBeans
...
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 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:
Code Block | ||||
---|---|---|---|---|
| ||||
MyServiceConfiguration config = new AbstractServiceConfiguration() {
... // your implementation
};
ReflectionServiceFactoryBean serviceFactory = new ReflectionServiceFactoryBean();
serviceFactory.getServiceConfigurations().add(0, config);
ServerFactoryBean svrFactory = new ServerFactoryBean();
svrFactory.setServiceFactory(serviceFactory);
...
Server svr = svrFactory.create();
|