XFire Migration Guide
Skip to end of metadata
Go to start of metadata

Completed Functionality and CXF analogues

XFire Feature

CXF Analogue

Aegis Binding

Ported.

Configurable Servlet

See the Servlet Transport page.

Eclipse Plugin

Eclipse tooling supported via the WTP project and will be included as part of Helios.

HTTP Transport

Ported.

JMS Transport

Ported.

JAX-WS/JSR-181 Annotation Support

Ported and CXF passes the JAX-WS/JWS TCKs.

JAXB

Ported.

MTOM

Ported - Supports fully streaming attachments now.

services.xml

Spring 2 XML will be supported for easy configuration. See the Configuration section.

Spring: XFireClientFactoryBean

See the ClientProxyFactoryBean and JaxWsProxyFactoryBean.

Spring: XFireExporter

Not ported as the *ServerFactoryBeans already enable this functionality. See below.

Spring: ServiceBean

Completed. See ServerFactoryBean and JaxWsServerFactoryBean.

WS-Addressing

CXF has much better WS-Addressing support and its easier to use as well.

WS-Security

Ported.

XMLBeans

Ported

For more details on how to migrate:

  • Are you using the ObjectServiceFactory, AnnotationServiceFactory, or JAXWSServiceFactory? Go->
  • Are you using services.xml? Go->
  • Are you using the XFireServlet? Go->
  • Are you using the Spring ServiceBean? Go->
  • Are you using the Spring XFireExporter? Go->

Should I Migrate Yet?

XFire users should consider migrating to CXF. Anyone looking to start a new web services project should seriously consider CXF. The main barrier is liable to be documentation at this moment. We will be adding LOTS more documentation though over the next couple weeks as we move toward the 2.0 final release.

CXF includes many new features for XFire users:

  • Improved WSDL support
  • Improved JAX-WS support
  • Improved JMS transport
  • Maven plugins
  • Spring 2.0 syntax support
  • Improved WS-* support
  • Cleaned up APIs for building services
  • Easier to use extension points
  • RESTful services support
  • Support for a "bare" XML binding, which doesn't include a SOAP envelope

Who should not migrate

There a couple small areas where we haven't replicated all of the XFire functionality yet. Namely the JiBX databinding. The only other reason not to migrate to CXF that we see is a requirement for Java 1.4.

Service Factories

XFire included serveral service factories for building services. CXF also includes service factories, but the concept has been improved somewhat to make them easier to use. CXF now includes the concept of ServerFactoryBeans which produce Servers, ClientFactoryBeans which produce Clients, and ClientProxyFactoryBeans which produce Client proxies.

CXF now includes the following classes:

  • ServerFactoryBean - This creates a server endpoint from a class
  • ClientProxyFactoryBean - this creates a client proxy from a class
  • JaxWsServerFactoryBean - This creates a JAX-WS server endpoint from a class or WSDL
  • JaxWsProxyFactoryBean - this creates a JAX-WS client proxy from a class

Its important to keep in mind a few differences in how CXF works compared to XFire:

  • CXF uses a bean factory approach. This means that there is one (Server/ClientProxy)FactoryBean per endpoint. In XFire these beans could be reused.
  • CXF requires that you specify the endpoint address, unless it finds it in your WSDL. If you're using HTTP this has some nice benefits.
    • If you haven't set up the Servlet transport, it will automatically start an embedded Jetty instance for you. In XFire this required you to use the XFireHttpServer class, resulting in additional work.
    • This allows you to map services to different URLs easier. In XFire the way URLs were mapped to Services was much more static.
  • When you specify an endpoint address for your service, it's important to remember that when you're using the sServlet you don't need to specify the host name. Lets say you set up the CXFServlet to listen on "http://localhost/services". If you specify your endpoint address as "/myservice" then all requests that come to "http://localhost/services/myservice" will go to your service.
  • JAXB is now the default databinding. Any time you want to use Aegis, you must explicitly say so.

Example ObjectServiceFactory Migration

Here is an example of using the ObjectServiceFactory in XFire:

This would be the CXF equivalent:

Example AnnotationServiceFactory Migration

Here is an example of using the AnnotationServiceFactory in XFire:

This would be the CXF equivalent:

Example JAXWSServiceFactory Migration

Here is an example of using the JAXWSServiceFactory in XFire:

This would be the CXF equivalent:

HTTP and Servlet Setup

CXF supports a much wider range of options for deploying your service over HTTP. XFire created a static mapping between the HTTP URL and the service name - i.e. a service named "HelloService" was accessible at http://localhost/services/HelloService. CXF on the other hand allows you to control the URL which your service is published on. This address is provided to CXF either through the setAddress() call on the ServerFactoryBeans or via your XML configuration.

Another improvement over XFire is that CXF will now transparently detect whether the CXFServlet is being used. If it is, your service will be available on that location. If it is not, CXF will automatically start an embedded Jetty instance (provided the cxf-rt-transports-http-jetty module is on your classpath). No more calls to XFireHttpServer are needed!

To set up the CXF servlet, please read the how-to on the Servlet Transport page.

To use the embedded Jetty instance, no extra work is needed. Simply follow the above ServiceFactory examples.

services.xml

XFire included support for deploying your services via a services.xml file. In CXF this file is named cxf.xml and will be loaded by the CXFServlet

XFire services.xml example:

CXF example:

There are a few important things to note here on the differences:

  • Many of these attributes are optional, such as the service name
  • You don't need to specify a serviceClass if you are using JAX-WS as your service should be annotated with the @WebService.endpointInterface attribute.
  • The equivalent of XFire Handlers is Interceptors inside CXF. They feature a much improved API!

The above sample is for JAX-WS/JSR181 services. For those developing services without annotations, here's an example for the Simple Frontend"

Labels
  • No labels