Jax Ws And Its Comparison With Axis2 Information Technology Essay
In todays world with the rise in development of newer and newer different stand-alone applications, the organizations and enterprises faces the difficulty in integrating all these incompatible applications for the ease of their business. In order to overcome this technical complexity more and more enterprises have started implementing the Web Services to make these heterogeneous applications work together.
Web Services can be defined as the application components that can be accessed over the network. Web Services makes the applications compatible by providing cross-platform interaction possible. Web Services provides a means of communication for applications developed in different programming languages using different technologies and running on different platforms. Thus, Web Services introducing interaction between such widely different applications makes the applications more flexible, loose and compatible.
In today’s trend of Service Oriented Architecture, Web Services play an important role. These Web Services functionalities are accessible using standard internet protocols. The keywords related to Web Services are HTTP, SOAP, WSDL, XML and UDDI. Any Web Service is defined in XML format, known as the Web Service Description Language. The service provider registers its services in the Universal Description Discovery and Integration (UDDI). The service requestor looks into the UDDI for a particular service. The client then uses a particular WSDL and its service end point to establish a connection with the service provider. The client establishes the communication by sending SOAP (Simple Object Access Protocol) messages over the HTTP (Hypertext Transfer Protocol).
There are many web services framework available such as Spring framework, Apache Axis2, Apache CXF, JAX WS, JAX RPC etc. This paper throws some light on JAX WS and Apache Axis2.
JAX-WS (JAVA API for XML-based Web Services)
JAX WS provides the Java API for creating and developing XML-based Web Services. JAX WS is the successor of JAX RPC (Java API for XML-based Remote Procedure Calls). Many enhancements and developments have been introduced in JAX WS from the JAX RPC mechanism. The main difference between these two mechanisms is that the JAX RPC provides call interface web services whereas the JAX WS provides the document style web services. JAX WS is the sun standard for the implementation of Web Services. Many big companies like Yahoo!, Google, Amazon do use JAX WS for the implementation of Web Services.
The JAX WS architecture unlike its forerunner also supports message based services along with remote procedure based services using the SOAP for communication.
JAX WS Implementation
Java API for XML-based Web Services makes it easier for developing XML-based Web Services using the Java programming Language. JAX WS supports its own implementation of JAX WS programming model and does not support Axis2 programming model. JAX WS defines model for developing application handlers that deals with data during Web Services runtime. The JAX WS converts the calls matching it with the SOAP messages. Annotations used in the JAX WS simplify the deployment and development of these Web Services, their service end points and the service requestors, clients. JAX WS requires Java EE 5 or later version of Java.
JAX WS provides two tools for generating Java artifacts, namely wsimport and wsgen for top-down and bottom-up approaches respectively
The wsimport tool is used for the top-down or the contract first approach that is the Java files are created from the WSDL file.
And the wsgen tool is used for the bottom-up approach or the code first approach that is the WSDL file is generated from Java classes.
JAX WS uses Java annotations to make the simple POJO classes work as the Web Services. For example, the annotation @WebService is used along with a Java class, to declare simple POJO class to act as a Web Service.
Considering a simple example
pubic class MyService
The JAX WS 2.0 uses annotations for declaring and attaching any data related to Web Services. Using the annotations makes it simpler for the user to create Web Services.
It provides better cross-platform interaction, making the communication platform independence.
The JAX WS supports both synchronous and asynchronous calls.
JAX WS supports asynchronous polling and callback.
Along with SOAP 1.1, the JAX WS 2.0 also supports 1.2
It also supports MTOM (Message Transmission Optimization Mechanism) for dealing with binary data among the Web Services and better optimization of the SOAP messages format.
JAX WS supports both REST and SOAP Web Services.
The Apache Axis is the Web Service project from the Apache Software Foundation. It is an open source web service framework for XML-based web services. The Axis has its implementation in Java and it is being developed in C++.
Using Axis2, we can implement Axis framework. The Axis2 is a Web Service container for the Axis framework for creating and developing XML-based Web Services. Axis2, as compared to its forerunner Axis1, has a much better, configured and flexible architecture. It also provides more scalability as well as productivity as compared to axis 1.
While creating and developing Web Services, the Ant build tool has an important role in the development process. The WSDL2JAVA and JAVA2WSDl are the two build tools that important for developing the Wed Services.
The WSDL2JAVA tool is used for the top-down or the contract first approach that is the Java files are created from the WSDL file.
And the JAVA2WSDL tool is used for the bottom-up approach or the code first approach that is the WSDL file is generated from Java classes.
For deployment of the Axis2 Web Services, it is necessary to create its own format aar file, and deploy it to the services folder of your axis2. The aar file is similar to a jar file and can be developed using the following command
jar -cvf MyService.aar
Benefits of using Axis2:
Axis2 supports both SOAP and REST Web Services
Axis2 also supports both, synchronous and asynchronous calls.
Also Axis2 supports Message Transmission Optimization Mechanism for binary data handling. But it has some limit to the size of the binary data it can handle.
Comparing Axis2 and JAX WS
Axis2 can be considered as more mature framework as compared to JAX WS framework
Axis2 supports ADB, JIXB, XMLBeans whereas JAX WS supports only JAXB for binding support.
JAX WS supports its own implementation of JAX WS programming model and does not support Axis2 programming model.
At the core of Axis2 is the AXIOM, while for JAX WS it’s the Java Annotations that works as the core
JAX WS in transport neutral but the Web Services feature pack only supports HTTP/HTTPS
Axis2 and JAX WS both handle the Bottom Up approach equally good
The Axis2 supports the Top Down approach a bit better as compared to JAX WS
Unlike Axis2, the JAX WS does not require any configuration file such as service.xml. It is all handled by the Java annotations.
Comparing these two Web Services frameworks, the choice cannot be deduced to either of the Web Service framework completely, because each one of them has different qualities.
The Axis2 has better and more mature architecture as compared to the other one. But at the same time, this adds to the complexity in implementation. Whereas the JAX WS, though a bit immature comparatively, is simpler and easy to implement. Plus, it also has an advantage of being the sun standard for the Web Services implementation, adding a feather to its hat.
Thus, depending on the service or implementation to be carried out, the appropriate Web Service framework can be selected, though the JAX WS is comparatively pretty simple to implement.Order Now