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

Java API for XML Web Services

In this tip, William Brogden discusses Sun's revision of the Java Web Services Developer Pack (JWSDP) called version 2.0.

The latest collection of Java based Web service developer tools is Sun's major revision of the Java Web Services Developer Pack (JWSDP), now version 2.0. The previous cycle of development of the JWSDP ended with version 1.6, released in mid 2005. The intent of this major revision is to better integrate technology use through the various toolkits. In version 2.0, the JAX-RPC (Java API for XML based Remote Procedure Calls) toolkit is gone, replaced by a new technology with the acronym, JAX-WS, the Java API for XML Web Services.

Officially, the JWSDP is aimed at supporting Web service development on Sun Java System Application Server Platform version 8.1 or higher. JWSDP installation and the Sun tutorial assume that is what you will be using. Many of the component toolkits in the JWSDP distribution, including he JAX-WS files, are NOT labeled as "redistributable" in Sun's release notes. However, most of the components, including JAX-WS, are also available in the GlassFish open source server project. Glassfish releases are covered by Sun's "Common Development and Distribution License" and may be distributed with your application.

Yes, having two JAX-WS releases makes for confusion! For example the JAX-WS version with the JWSDP is labeled "EA" for early access, but the release from project GlassFish is labeled "RI" for reference implementation. The final release of the JAX-WS specification as a product of the Java Community Process, JSR 224, just occurred in May, so we are dealing with the very latest material here.

The Goals of the JAX-WS 2.0 Specification

The full statement of the JSR 224 specification takes 149 pages of PDF document so I can only touch on each aspect briefly. These are the goals of JAX-WS 2.0:

Consolidate Data Binding

Previously there were "data binding" tools in both the JAXB (Java API for XML Binding) and JAX-RPC (Java API for XML Remote Procedure Calls) toolkits. This was obviously a source for confusion so JAX-WS will use JAXB 2.0. My previous article gave more details on JAXB.

Support Evolving Standards

Although many current Web services use the SOAP 1.1 standard for the protocol, format and syntax of Web service messages, the 1.2 standard has been out for a while and should see increasing support. JAX-WS will support the SOAP 1.2 standard while continuing to support the older 1.1 standard. Since SOAP 1.2 changes some aspects of SOAP message syntax, this is not a trivial problem. Incidentally, when the acronym SOAP first appeared it was supposedly for Simple Object Access Protocol. Since everybody agrees SOAP is not simple and has little to do with objects, we just call it SOAP without any other implications.

There is a similar evolving standard problem with WSDL (Web Service Description Language), used extensively in all areas of Web services. A WSDL document is an XML formatted description all the details needed to contact a Web service. The current version in use, which is not an actual W3C standard, is version 1.1. Although the W3C recently ratified the standard for version 2.0, JAX-WS does not presently attempt to support it.

Another standard is being evolved by the Web Services Interoperability Organization. The WS-I Basic Profile appears to have been developed because the SOAP standard is not sufficiently well defined to ensure that all Web service toolkits can talk to each other. JAX-WS will conform to developments in this area.

Make use of Java Language Advances

Java has always provided for one form of annotation in source code in the form of a set of comment keywords starting with the @ symbol that can be processed by the javadoc tool to generate HTML formatted pages of documentation. These documentation comments do not end up in the compiled Java classes.

The latest edition of the language, called Java 5 or Java 1.5 depending on where you are looking in the documentation, adds an important new feature. It is a kind of annotation that gets built into compiled classes and can be accessed at runtime. You can think of these annotations as metadata that describe how a class can be used -- for example, how it should be accessed as a Web service.

To give you an idea, here are a couple of the annotations in the JAX-WS sample Java source file AddNumbersIF.java for a Web service that returns the sum of two input numbers:

@WebService(targetNamespace = "http://duke.org", name="AddNumbers")
@WebMethod(operationName="add", action="urn:addNumbers")

Because these annotations end up in the compiled classes, the JAX-WS tools that work with compiled Java class files using the Java introspection facilities can get extra information about how the programmer intends the class to be used.

Transport Independence

Because we are talking about "Web services," people tend to forget that SOAP message transport is not restricted to HTTP (Hypertext Transfer Protocol.) There are plenty of applications in which transport by email or Java Message Service make better sense. The JAX-WS API document states that it is intended to "improve the separation between the XML message format and the underlying transport mechanism to simplify use of JAX-WS with non-HTTP transports." Development of examples using alternate transport mechanism seems to be lagging the HTTP Web service examples, but I did find one example using Java Message Service in the Glassfish project.

References

Main page for the JWSDP 2.0 release. http://java.sun.com/webservices/jwsdp/index.jsp main Sun page for JWSDP

Main page for the JAX-WS Reference Implementation as part of Project GlassFish. https://jax-ws.dev.java.net/

Web Services with JAXB from the JWSDP 2.0 release https://searchmicroservices.techtarget.com/tip/Web-services-with-JAXB

Java Community Process home for JAX-WS 2.0. http://jcp.org/en/jsr/detail?id=224

Java Community Process homes for Metadata (annotations) and web service Metadata specifications. http://www.jcp.org/en/jsr/detail?id=175, http://www.jcp.org/en/jsr/detail?id=181

Text of the Common Development and Distribution License (CDDL) Version 1.0.1 https://jwsdp.dev.java.net/CDDLv1.0.html

Introduction to SOAP 1.2 at the W3C https://www.w3.org/TR/soap12-part0/

Proposed Web Services Description Language (WSDL) version 1.1. https://www.w3.org/TR/wsdl

Web Services Interoperability Organization (WS-I Basic Profile) http://www.ws-i.org/

About the author

William Brogden is a developer who lives outside Austin, Texas. Although he has been working mainly with Java for the last ten years, he enjoys investigating new computer languages and XML applications.

Dig Deeper on Topics Archive

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchSoftwareQuality

SearchAWS

SearchCloudComputing

TheServerSide.com

Close