Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

The Axis2 Web services toolkit

Apache's Axis2 Web services toolkit has built itself on the new AXIOM object model and StAX parsing. This tip looks into its evolution and what it offers for WS-* standards support.

The history of Apache Software Foundation Web service toolkits mirrors the evolution in developer understanding of SOAP and Web services concepts. The first Apache Software Foundation open source Web service related project was simply called SOAP. It was released in mid 2000 based primarily on code from IBM's SOAP4J project. At that time, most people were thinking of Web services as a kind of remote procedure call (RPC) using HTTP for transport and XML for encoding. This approach has gradually been replaced by thinking of Web services in terms of moving XML-formatted documents using the SOAP protocols.

As it became obvious that SOAP and Web services were going to become a big deal in computing, the project structure at the Apache Software Foundation mutated. Most Web services related open source projects are now based on the "Apache Web Services Project."

The first Apache SOAP toolkit parsed the entire request or response XML message into a document object model (DOM) in memory before further processing. This approach was conceptually simple, but could not handle large messages well because the toolkit always builds a complete DOM before turning processing over to application code. When it became clear that the DOM approach had serious limitations, a new ASF project called Axis was started.

Version 1.0 of Axis 1 was released in late 2002. It used SAX parsing for speed and memory use improvement over DOM parsing. It provided direct support for WSDL and worked well with the Java standard library XML APIs. SAX is a "push" style parser, which has the disadvantage that there is no convenient way to stop the parser in a way that facilitates passing the XML document on to the next stage of processing. The latest release, version 1.4, released in 2006, is still extensively used for Web services because many developers have felt that Axis2 is not fully developed.

Axis2 is a complete redesign of the toolkit based on the lessons learned from Axis 1. Initial versions of Axis2 have been public since early 2005, but major revisions continued to be made. Version 1.3, released Aug 13 2007, is probably stable enough to be useful to developers. In addition to supporting the most recent standards, the architecture is designed to support easy addition of plug-in "modules" to keep up with rapidly evolving WS-* standards. Axis2 uses a new XML programming model called AXIOM (Axis Object Model).

Why Axis2 uses AXIOM

AXIOM is a completely different approach to efficient handling of SOAP messages. It is considered one of the major innovations introduced in Axis2. The problems AXIOM tries to solve have been introduced by the proliferation of additions to the original SOAP concept of XML-formatted messages flowing between a client and a service. These additions mean that a SOAP-formatted message may be passed through many processes before reaching a final destination. Many of these processes only need to look at certain elements of the message so completely parsing the message at each step would be very wasteful.

The AXIOM approach attempts to provide a way for each stage of processing to only parse what it needs and efficiently pass the message to the next stage. Basic document parsing uses the "pull-parsing" model which provides a convenient way to stop parsing a document as soon as you have found what you were looking for while preserving the entire document. The particular pull parser used is called StAX (Streaming API for XML). A StAX parser implementation is part of the Java standard library since version 1.6.

The AXIOM approach also supports XML-binary Optimized Packaging (XOP) and SOAP Message Transmission Optimization Mechanism (MTOM). These extensions to SOAP attachments attempt to overcome the basic inefficiency of representing extensive amounts of binary data in XML documents.

Axis Toolkits and Standards

Axis 1 and Axis2 support many commonly used Web service standards and toolkits. I only have room to quickly summarize these as follows:

SOAP: The SOAP standard defines the XML elements which enclose the application specific data and outlines the basics of processing a SOAP message. Both Axis toolkits support the current SOAP 1.2 specification.

WSDL: Both Axis toolkits support automatic creation of Java client and server classes from a WSDL version 1.1 document and the reverse creation of WSDL to match an existing Java class.

POJO: The delightful acronym for a Plain Old Java Object offers a simple way to get a web service running quickly. Provided your Java object meets certain design criteria for method naming, AXIS 2 provides a simplified method for turning it into a web service.

REST: Representational State Transfer is a simplified alternative to SOAP for Web services currently getting a lot of developer interest. The Axis2 server side and client side libraries can be configured to enable processing of a REST-style request by a SOAP service.

WS-Policy: WS-Policy documents provide a syntax for expressing Web service features and requirements in a more general fashion than is provided by WSDL or UDDI descriptions and is related to many of the new WS-* specifications. Axis2 supports many features of the current WS-Policy 1.5 recommendation.

The Future of Axis2

It is by no means clear that the Axis 2 toolkit will become the approach of choice for Web service developers. At the present state of development, the AXIOM document model is not achieving the hoped for speed and memory efficiency. There are many toolkits for SOAP, both open-source and commercial, competing for developer attention.


The starting page for the Apache Web Services Project.

A detailed discussion of the advantages of AXIOM.

A short explanation of the REST approach to Web services.

Dig Deeper on Software development toolkits (SDKs)

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.