Monday, February 05, 2007

[Pub] Webservices with Axis and xFire

In the current print-issue of Infoweek.ch Markus Demolsky and I wrote an article about Apache Axis 2 and Codehaus xFire. This article is also online available (in German).

Both frameworks can be used to build modern Web-Service driven architecture, however choosing the right one for the projet is not always an easy decision:

Apache Axis


Apache Axis has a long history. The first Webservice project in the Apache pool was Apache SOAP donated from Lotus. This was more a proof of concept than a framework for operational use (as I realised myself by suffering incredible pains during a project). However the next step on the road was Apache Axis 1. Both projects are still available on the Apache websites. However, SOAP should definitly not be used for projects, and also Apache Axis 1 is actually deprecated.

The current installment is Apache Axis 2. It is again a redesign of Apache 1 and is up-to-date with modern standards like:
  • SOAP 1.1 and 1.2
  • REST style services
  • WS-reliable messaging
  • WS-Coordination and WS-AtomicTransaction
  • WS-Security
  • WS-Addressing
  • basic message exchange patterns in WSDL 2.0
and better performance.Under the hood the new object model Axiom (based on a pull parser) promises less memory consumption and better performance. Additionally improved handling of message-style interactions (Axis 1 SOAP RPC) MEPs that include synchronous, asynchronous messaging are added.

A difficult issues is data-binding in document-style webservices. Generally spoken, the problem is to map object hierarchies (from Java, .net, ...) to xml data-structures. As there are specialised frameworks for data-binding (due to the complexity of the problem) Axis 2 supports pluggable data-binding. There is the option to use ADB, the Axis data-binding, but also XmlBeans, JiBX, JAXME and JAXBRI.

An interesting additional option of Axis 2 is the REST support! Services can be provided in "SOAP Webservice" style as well as in REST.

Codehaus xFire

The "Next Generation SOAP framework" is currently available in version 1.2.4 and provides an easy to use SOAP framework. It is a servlet based application and uses the new StAX parser to ensure high performance. As Axis xFire supports a lot of current Web Service standards.

In order to expose components as web service, developers can choose between the xFire API, XML configuration or the new Web Service Annotations. A unique feature of xFire is the support of Web Service annotations. Developers can annotate their service components with predefined web service annotations which are then processed by xFire to create the WSDL.

As Axis, xFire provides a pluggable data binding architecture. There is the option to use Aegis, the xFire data binding, but also XMLBeans, Castor, JiBX, JAXB. Transaction management, Security, logging and loose coupling are important tasks when developing enterprise applications. Therefore current software systems are built on top of containers, like Spring or Plexus. The team of xFire had detected the importance of containers in software systems and therefore provide a wide range of container integrations (Spring, Plexus, Loom, Pico or Yan).

Fazit

Even with modern Web-Services frameworks writing reliable and portable (non-trivial) webservices is not necessarily an easy task. Even if IDEs suggest that writing a webservice is "just a click" in the wizard, this is actually not the case. A lot of configuration options are available, data-binding is a complex issue and so is interface specification with WSDL 2.

Documentation of both frameworks is ok, but not good. At least not sufficient to learn webservices. To be able to develop robust webservices it is highly recommended to get a good knowledge about the according standards like SOAP, WSDL (the needed WS-* standards) and the concept of data-binding and servlets and probably also of Java annotations. If this knowledge is available, the documentation of the projects should be sufficient.

Read more...

... in our Infoweek article.

Alexander Schatten, Markus Demolsky

No comments: