Sunday, September 28, 2008

Overview of Web Service Stacks

There are currently the following open-source Java Web Service stacks in the market today.There could be more that I am unaware of, but at least the following contribute more significantly to the market share.
  1. Apache Axis1 and Apache Axis2
  2. Apache CXF
  3. Spring-WS
  4. Sun’s Metro available via Java EE 5 GlassFish container
  5. JbossWS
  6. XFire - which is now merged and transformed to being CXF.
This article is a comparative interview with each of the web service stack’s Principal Engineers and their vision for their product. http://www.infoq.com/articles/os-ws-stacks-background The second article is a comparison between Apache’s 3 products – Axis1, Axis2 and CXF. http://www.theserverside.com/tt/articles/article.tss?l=AxisAxis2andCXF Both of these articles are non-biased articles with no claims of one being better than the other. They leave it up to users to pick the one most matching their needs and demands. Sun has now published the standards for Web Services and it has now become imperative for all the Web Service stacks to provide implementations of those for conformance. Every web service stack provides the core functionality of:
  1. Providing an easy-to-use deployment option. 
  2. Correct Web service/operation invocation for the particular message(SOAP/REST). This further involves in the following order -
  • Receiving the message over the correct transport endpoint(Endpoint is an abstraction to represent URL and port),
  • Figure out the operation intended to perform based on the message, and then
  • Invoke the correct Java method mapping to the operation.
    3.  Pre-processing the messages via handlers to perform various functions like authentication, logging, custom processing etc.
    4. Marshaling/Unmarshaling mechanism of the request and response structures to/from Java<=>XML.
   5.  In addition, today's web service stacks are expected to provide implementations for the various WS-* standards that exist.

With respect to points # 2 and # 4 above, Mark Hansen has correctly pointed out:
The key technology for efficient SOA is efficient and accurate Java/XML mapping or more generically known as the OXM (Object-XML Mapping)as pointed out by Spring-WS. At the SOA level, system standards are specified using platform independent XML messages (SOAP/REST) and WSDL operations (which themselves are in XML). But at the language level (Java/C#/VB etc), the systems that are the real engines behind the functionality of SOA are implemented using objects and methods. The more seamless effortless and accurate OXM solution that a web service engine provides the more popular it will be.

Programming Java Web Services

For someone who is a total newbie to the world of Java Web Services(JWS), here's a list of the different JSRs/standards within the realm of JWS that are available with Java EE 5 and Java SE 6. They all have a particular purpose in the whole orchestration of JWS.
  1. JAX-WS 2.0 (Java API for Xml-Web Services) - specified by JSR 224.
  2. This was formerly JAX-RPC 1.1. JAX-RPC 1.1 was a standards-based implementation, but the binding and parsing layers underneath it were proprietary. When JAX-RPC 1.1 needed a major overhaul, the next JAX-RPC version would have been JAX-RPC 2.0 But the industry evolved more than just doing RPC-style web services. So to accommodate the message-style web services as well, which are becoming more and more common, "RPC" was dropped to become a more general JAX-WS 2.0
  3. JAXB 2.0 (Java API for Xml Binding) - specified by JSR 222.
  4. This specification defines and nominates JAXB as the default mechanism for serializing and de-serializing the XML messages contained within the SOAP message and Java objects. There are sure other ways to do this job via other Java-XML binding mechanisms - like XMLBeans, JiBX, Castor etc. But the JWS specs (defined by Sun) decided to make JAXB 2.0 as the "default" standard.
  5. WS-Metadata 2.0 (Web Services Metadata) - specified by JSR 181.
  6. Deploying Web services is quite a feat. One would normally require a set of deployment descriptors a la typical J2EE applications. But from Java EE 5 onwards, we now have web services-specific metadata annotations to achieve the deployment.
  7. WSEE 1.2 - Web Services for Java EE - specified by JSR 109.
  8. This defines the program model and run-time beahvior of Web Services in the Java EE container.
All these standards can be complex to understand at first, and after surfing a lot on the web for an in-depth perspective, I have finally landed on the book "SOA Using Java Web Services" by Mark D. Hansen.