+49 228 5552576-0

Apache Axis2, CXF and Sun JAX-WS RI in comparison

Thomas Bayer

By: Thomas Bayer
Date: 10/20/2008
Last Update: 09/10/2010

Axis2, CXF, the JAX-WS Reference Implementation and JBossWS are all Web Services toolkits for the Java platform. This article describes the differences and provides decision guidance for developers and architects.

Apache Axis2

Axis2 is the follow-up of the popular Axis1 framework. Axis2 is based on a completely new architecture and has been rewritten from scratch. That makes Axis2 very flexible. For instance the databinding that is responsible for the serialization of Java objects into XML is not limited to one technology. For instance the following databindings are available:

Data Binding Description
ADB The Axis2 Databinding Framework is leightweight and simple but doesn't cover all XML Schema functions.
JiBX Allows the use of pojos without any modifications. A mapping defines how the pojos are serialized to XML.
XMLBeans Offers the most comprehensive XML Schema support.

Table 1: Axis2 Databindings

Asynchronous Web Services are well supported by Axis2. An Axis2 service accepts also asynchronous requests without any changes to the service. The service can use an endpoint reference delivered in the request to address a callback after finishing an asynchronous request.

Asynchronous Web Service Invocation

Figure1: Asynchronous Web Service Invocation

The deployment of services for Axis1 has often been criticized. Therefore Axis2 has a completely new deployment model. An Axis2 runtime is a Web application and can be installed on every JEE compliant Application Server. The Axis2 web application itself is a container for Web Services. Web Services are packed into an own file format with the file extension aar. Due to these archives, Web Services can be installed and configured by a simple user interface at run time. A Web Service is regarded as an independent package which can be installed into the Axis2 runtime environment. Services are configured using the service.xml configuration file.

Axis2 Deployment

Figure2: Axis2 Deployment

Axis2 offers modules providing additional functionality, for example WS-* standard support, which can also be installed during runtime.

Apache CXF

CXF is also a project of the Apache software foundation. CXF came up from a fusion of XFire and Ionas Celtix project.

CXF was developed with the intention to integrate it into other systems. This is reflected in the CXF API and the use of the Spring framework. Therefore it is simple to integrate CXF into existing systems. For instance CXF respectively its predecessor XFire was integrated into numerous open and closed source projects like ServiceMix or Mule.

A proprietary API as well as the standardized JAX-WS interface are available for the development and use of Web Services.

The JAX-WS Standard

The Java API for XML based Web Services is the successor of the JAX-RPC specification. JAX-WS respectively its predecessor is message based and supports asynchronous communication. The Configuration is managed by annotations therefore Java 5 or higher is required. JAX-WS isn't downwardly compatible to its predecessor JAX-RPC. With JAX-WS it is pretty easy to write and consume Web Services. The default values of numerous parameters are comfortable for the programmer, so that simple Pojos declared with a @WebService annotation can be used as a Service. Listing 1 shows a simple implementation of a Web Service using the @WebService annotation.

import javax.jws.WebService; 
import javax.jws.WebMethod; 

public class HelloWorldService {
	public String helloWorld() { 
		return "Hello World!"; 
Listing 1: HelloWorld Web Service using JAX-WS

A WSDL document can also be generated from the class. Annotations can influence the content of the generated WSDL document. For example a different namespace or other element names can be used. If JAXB is already known to the programmer, its annotations can be used to define the serialization in every detail. With the contract first approach a Service Interface, JAXB annotated classes for serialization and a skeleton for the implementation can be generated out of WSDL. According to the WSDL document the generated classes can have numerous annotations. Annotations are also the main point of criticism of JAX-WS. Despite this criticism the JAX-WS specification came out well. It is well attuned and combinable with other Java and Java EE specifications. For example, Listing 2 shows a stateless EJB 3.0 Bean which acts as a Web Service at the same time.

public class MyService{
 public String hello(String name) {
     return "Hallo"+name;
Listing 2: Stateless SessionBean acting as Web Service

JAX-WS Reference Implementation

The JAX-WS Reference Implementation represents the core component of the Web Services protocol stack Metro. The Metro Stack provides support for the following Web Services standards:

JAX-WS and Metro are documented in detail. Apart from the JAX-WS, JAXB and JWS specifications there are numerous tutorials und samples. The Netbeans IDE as well as the tutorials of the enterprise pack makes it particularly easy to get started. Of course, Eclipse can also be used for the development with Metro.

Web applications containing Web Services which have been realized with JAX-WS are executable in Glassfish and many other application servers. To make services also executable in Tomcat, two libraries (JAX-WS and JAXB) have to be installed.


JBossWS is the Web Services Framework for the JBoss application server. By providing an integration layer it is possible to choose from three stack options:


Due to the modern streaming StAX parser, the performance of all three SOAP engines is very well. The ping time for a locale roundtrip is less than 1 millisecond (message size about 3KB, Dual Core Notebook). Therefore the time delay by the SOAP communication is negligible in many projects.

WS-* Standards

The support of the WS-Standard family can also be decisive for the selection of a SOAP engine. For example, messages sent to services can be secured with signatures as described in the Web Service Security standard (in short WSS). Table 1 lists the supported WS-* standards for each toolkit.

Standards Axis2 CXF JAX-WS/Metro
WS-Addressing X X X
WS-Coordination X(2) X
WS-MetadataExchange X
WS-Policy X X X
WS-ReliableMessaging X(3) X X
Web Services Security X(1) X(4) X
WS-SecureConversation X(1) X(4) X
WS-SecurityPolicy X X X
WS-Transaction X(2) X
WS-Trust X X X

Table 2: Support for WS-* Standards ( as of August 2010)

(1) Supported by the additional module Apache Rampart
(2) Supported by the additional module Apache Kandula2
(3) Supported by the additional module Apache Sandesha2
(4) By Apache WSS4J


None of the Web Services frameworks is in general superior to the others. Axis2 is structured modularly, has many features and can be used as an application server for Web Services. A special feature of Axis2 is the support of exchangeable binding frameworks, for example XMLBeans. Axis2 together with the XMLBeans framework is well suited for Web Services which are using very complex schema definitions. The disadvantages of Axis2 are its complexity as well as the insufficient JAX-WS support. Therefore anyone who wants to work with JAX-WS should choose Apache CXF or the reference implementation.

Those who prefer a seamless integration with the Spring framework are well advised with Apache CXF. Furthermore CXF is slim and easy to use. CXF is the tool of choice if a SOAP engine has to be embedded into an existing software.

Who wants to code against the standard is well advised with the JAX-WS implementation. The enterprise pack of the Netbeans development environment supports JAX-WS RI very well. Only a few clicks are needed to build a server or to call a Web Service. The Metro stack that includes JAX-WS RI offers the most comprehensive support for the WS-* standards. A major advantage of Metro 2.0 is its compatibility with Microsofts Windows Communication Foundation.

I hope this article could help you with the decision for a WS toolkit.

Thomas Bayer, Marco Hippler
bayer@predic8.com hippler@predic8.com


Now covers Axis2 1.5.1, CXF 2.2.10, JAX-WS RI 2.2.1 and Metro 2.0