Java Reference
In-Depth Information
Chapter 6. Creating Web Service Applications with
JAX-WS
Introduction
The SAAJ API, introduced in Chapter 5 , offers a powerful, flexible way to work with web
services at a low level. The Java API for XML Web Services (JAX-WS) is a high-level API
for consuming and providing web services. This chapter introduces JAX-WS and shows you
how to use it for a wide variety of practical tasks.
JAX-WS in Relation to Other APIs
JAX-WS replaces the older JAX-RPC API. Unlike SAAJ, JAX-WS doesn't require you to
know very much about XML or WSDL. The entire XML layer is hidden from developers,
who can instead just work with objects generated by web services tools that come with Java
SE 6 and EE 5. These objects encapsulate all of the work of creating SOAP messages, invok-
ing the service, and parsing responses, hiding significant complexity from developers. This
can be convenient, and can make client maintenance much easier.
JAX-WS actually is built on top of SAAJ, using it under the hood to do its parsing and com-
munication work. As you know, a web service as represented in a WSDL will define XML
types for each of the message parts used in service requests and responses. In order to cre-
ate object representations of these types, you need a binding language to convert (marshal)
from Java to XML and back again. In the older API, this was done directly within JAX-RPC,
which defined its own conversion mechanism. However, this was later deemed to complicate
the specification, and Java to XML conversion came to be viewed as something that deserved
a standalone specification. So instead of defining its own such mechanism as JAX-RPC did,
JAX-WS uses the external JAXB 2.0 (Java API for XML Binding) spec. JAX-WS supports
message-oriented and RPC-oriented web services.
Different Java EE vendors have implemented JAX-WS. The reference implementation, called
Metro, was introduced in Installing Metro , and provides a number of other features, including
implementations of key WS-* specifications that support, in particular, interoperability, secur-
ity, and reliable messaging. JAX-WS also supports WS-Basic Profile 1.1, which is a standard
that service implementations can conform to in order to ensure interoperability across plat-
forms.
Search WWH ::




Custom Search