Java Development News:

Axis, Axis2 and CXF: Surveying the WS Landscape

By Bjorn Townsend

01 Sep 2007 |

Download the Open Source Tools & Platforms eGuide

Learn more about open source tools & platforms such as:

  • What's New in Spring 2.0
  • Using Hibernate & Tomcat
  • Struts Action Mapping
  • Challenges in Framework Construction

It's an exciting time to be in open source web services development. Two new next-generation web services frameworks have been released in the last year and a half, both under the umbrella of the Apache Software Foundation. These frameworks are Apache Axis2, which hit 1.0 at the end of April, 2006 and is currently in the release candidate stage for version 1.3, and Apache CXF, which released version 2.0 (the first version released under that name) in early July 2007.

Both frameworks also evolved from existing projects. Axis2 came from the well-known Axis 1.x series. CXF is literally the offspring of the XFire and Celtix projects, as those two projects have pooled their codebases and development teams to give rise to CXF. The delta between the old projects and their new versions is significant in each case. Axis2 is a total rewrite of Axis from the ground up, using a new modular architecture that allows its functionality to be more easily extended. CXF has also been extensively retooled from its XFire and Celtix origins.

This leads to a few questions. Should existing applications using Axis 1.x, XFire or Celtix move to the new versions of those projects? If a developer does decide to migrate his or her application to one of the new frameworks, which one should they use? Conversely, if one is writing a new web service from the ground up and no migration is required, which one should they use? Is one framework inherently better than the other?

Let's tackle these questions in order. Firstly, should existing applications migrate? The answer to that question depends largely on the point in its lifecycle your application has reached. A project which is very static and mature, with few or no changes expected in the foreseeable future, probably doesn't need to migrate as the current framework is serving its needs well enough. If the application's performance or functionality is impacted by bugs, it might be worth migrating, particularly for users of Axis 1.x, as most of the developer community around Axis has refocused its resources around Axis2. An Axis 1.5 release is in the works, but it may not happen for many months down the road.

As for which project to migrate to, it might be easiest to move to to the next generation of your current framework. Both Axis2 and CXF provide migration guides that give developers tips on how to migrate from their previous versions, but as of this writing neither project has provided migration tools or guides for porting web services from one framework to another. In such a migration, though, it's always worth looking at all the options available. Axis2 and CXF each take different approaches to web service development, and these approaches will appeal more to some developers than others.

This brings us to a good point to compare Axis2 and CXF on their own merits. They are of course in many ways comparable; of necessity web services frameworks must fill in all the same blanks, but since both projects are very young, each has certain areas that are more well-developed than others. The chief differences are as follows:

  • CXF has support for WS-Addressing, WS-Policy, WS-RM, WS-Security, and WS-I BasicProfile. Axis2 supports each of these except for WS-Policy, which will be supported in an upcoming version.
  • CXF was written with Spring in mind; Axis2 is not.
  • Axis2 supports a wider range of data bindings, including XMLBeans, JiBX, JaxMe and JaxBRI as well as its own native data binding, ADB. Note that support for JaxME and JaxBRI are still considered experimental in Axis2 1.2. CXF currently supports only JAXB and Aegis; support for XMLBeans, JiBX and Castor will come in CXF 2.1.
  • Axis2 supports multiple languages--there is a C/C++ version available in addition to the Java version.

In comparing these frameworks, though, it's just as important to look at their approach to developing web services as it is to compare features. From a developer perspective, both frameworks behave very differently from one another. Axis2 has taken an approach that makes it in many ways resemble an application server in miniature. Axis2 comes packaged with a WAR that can be deployed on a servlet container such as Tomcat that is designed to make web services easier to manage and deploy on the fly. The Axis2 Web Administration module allows Axis2 to be configured dynamically while applications are running--new services can be uploaded, activated or deactivated and their parameters may be changed. The administration UI also allows modules to be enabled on one or more running services. The only downside to using the UI for these purposes is the fact that configuration changes made through it are not persistent--they go away when the servlet container is restarted.

Axis2 lends itself towards web services that stand alone, independent of other applications, and offers a wide variety of functionality, and a good model for adding more functionality as time goes on through its modular architecture. Some developers may find that a little too cumbersome or heavy-duty for their needs. These developers might prefer to look at Apache CXF.

CXF concentrates on developer ergonomics and embeddability. Most configuration is done via the API instead of cumbersome XML files, Spring integration is heavily emphasized, including support for Spring 2.0, and CXF's APIs and Spring configuration mirror one another fairly closely. CXF emphasizes code-first design, using simple APIs to make development of services from existing applications easier (and its embeddability helps too).

Whichever framework you choose, you'll have the benefit of an active and stable open source community. Each of these frameworks has corporate backing: Axis2 is backed by WSO2, and CXF by Iona. Both have lively developer communities. Axis2 has been around longer but CXF is catching up quickly. My recommendation is this: If multilanguage support is important, Axis2 is the clear choice. If you care about an implementation focused on Java with tight integration into projects like Spring, CXF is a better choice, particularly for embedding web services inside of other programs. If the new features in these projects are not important, and you're relatively happy with Axis1, you should consider staying on this and keep up with the latest maintenance releases until you have a business reason to migrate.

About the Author

Bjorn Townsend has spent the last two years working as an Open Source Engineer at SourceLabs Inc. His focus is on Java web services, networking and IT infrastructure. His is a frequent contributor to a number of Open Source projects.