Thursday, August 18, 2011

Web Services Framework

A web services is primarily a software interaction. Softwares have been interacting with each other right from beginning, but web services make it better by providing a XML format exchange. More details on web services can be seen at web services section.
At the moment in Java landscape, there are many web services framework which provide both server and client side implementation framework. The prominent names doing round are as follows:

JAX-WS
JAX-RS
JAX-RPC
Axis 2
Apache CXF
Metro
...

I would first clear the difference between JAX-WS and JAX-RPC. JAX-RPC is the framework which is part of standards and is in J2EE 1.4. From JavaEE 5.0, JAX-WS has replaced JAX-RPC. JAX-RPC is still though supported for backward compatibility. In terms of choice between JAX-WS and JAX-RPC, if you are in Java 5.0+, the choice should always be JAX-WS. If you in J2EE 1.4 or less, there is no choice. You have to go for JAX-RPC. Metro is a reference implementation for JAX-WS as JWSDP (Java Web service developer pack) was the reference implementation of JAX-RPC, Being a part of JavaEE standard, you will find automatic support of that in various JavaEE compliant application servers. From JavaSE6+ ,JAX-WS is supported in the standard edition itself.
Now we will see the frameworks that are in the community space. In this space Apache Axis has been the most popular. In J2EE1.4 era, Apache Axis was almost used everywhere because of ease of use. Also JAX-RPC has issues with server portabilities as it has part of features which has to be handled in server specific way. Axis provided the portability.
However with JAX-WS the tables are turning again. JAX-WS has a very simple implementation specification. Most of the time deploying web service is a matter of annotation. Also it has been specified in such a way that server dependency has been removed. So at this moment I would suggest JAX-WS. If you are still tied to J2EE1.4 or less, Apache Axis would be a good choice. One of the benchmark comparison is at
Also before you venture into web service space you might also want to have a look on the Restful web services.
Whether you are for JAX-WS or JAX-RS, it depends on whether you are in SOAP/WSDL camp or in REST camp. Personally, I feel both has advantages and disadvantages and that should govern the choice. A broad thumb rule is that if there are many parties who are going to use your web service, than SOAP/WSDL style is a better choice as it is structured uniformly. Also with SOAP the notion of header and body helps in handling concerns like authentication etc. However if you are talking to a limited client base, than REST is a good choice.

No comments:

Post a Comment