Home

 

Web services in Java EE 5

Web services provide a standard means of communication among different software applications. Because of the simple foundation technologies used in enabling Web services, it is very simple to call a Web service regardless of the platform, operating system, language, or technology used to implement it.

A service provider creates a Web service and publishes its interface and access information to a service registry (or service broker). A service requestor locates entries in the service registry, then binds to the service provider in order to invoke its Web service.

Web services use the following standards:

Simple Object Access Protocol (SOAP): A protocol for exchanging XML-based messages over computer networks, normally using HTTP or HTTPS

Web Services Description Language (WSDL): Describes Web service interfaces and access information

Universal Description, Discovery, and Integration (UDDI): A standard interface for service registries, which allows an application to find organizations and services

The specifications for these technologies are available at:

http://www.w3.org/TR/soap/
http://www.w3.org/TR/wsdl/
http://uddi.xml.org

Figure | -7 shows how these technologies fit together.

Figure 2-7 Web services foundation technologies

Since Java EE 1.4, Web services are included in the specification, so all Java EE application servers that support Java EE 1.4 or higher have exactly the same basic level of support for Web services; some also provide enhancements as well.

Java EE 5 provides full support for both clients of Web services as well as Web services providers. The following Java technologies work together to provide support for Web services:

Java API for XML Web Services (JAX-WS) 2.0: It is the primary API for Web services and it is a follow-on to Java API for XML-based Remote Procedure Call (JAX-RPC). JAX-WS offers extensive Web services functionality, with support for multiple bindings/protocols and RESTful Web services. JAX-WS and JAX-RPC are fully interoperable when using SOAP 1.1 over HTTP protocol as constrained by the WS-I basic profile specification: (http://www.jcp.org/en/jsr/detail?id=224).

Java Architecture for XML Binding (JAXB) 2.0: It provides a convenient way to bind an XML shema to a representation in Java code as used in SOAP calls. This makes it easy to incorporate XML data and processing functions in Java applications without having to know much about XML itself: (http://www.jcp.org/en/jsr/detail?id=222).

SOAP with Attachments API for Java (SAAJ) 1.3: It describes the standard way to send XML documents as SOAP documents over the Internet from the Java platform. It supports SOAP 1.2: (http://www.jcp.org/en/jsr/detail?id=67).

Streaming API for XML (StAX) 1.0: It is a streaming Java-based, event-driven, pull-parsing API for reading and writing XML documents. StAX enables to create bidirectional XML parsers that are fast, relatively easy to program, and have a light memory footprint: (http://www.jcp.org/en/jsr/detail?id=173).

Web Services Metadata for the Java Platform: The Web Service Metadata specification defines Java annotations that make it easier to develop Web services: (http://www.jcp.org/en/jsr/detail?id=186).

Java API for XML Registries (JAXR) 1.0: It provides client access to XML registry and repository servers: (http://www.jcp.org/en/jsr/detail?id=93).

Java API for XML Web Services Addressing (JAX-WSA) 1.0: It is an API and framework for supporting transport-neutral addressing of Web services (http://www.jcp.org/en/jsr/detail?id=261).

SOAP Message Transmission Optimization Mechanism (MTOM): It enables SOAP bindings to optimize the transmission and/or wire format of a SOAP message by selectively encoding portions of the message, while still presenting an XML infoset to the SOAP application: (http://www.w3.org/TR/soap12-mtom/).

Web Services Reliable Messaging (WS-RM): It is a protocol that allows messages to be delivered reliably between distributed applications in the presence of software component, system, or network failures: (http://www.ibm.com/developerworks/library/specification/ws-rm/).

Web Services for Java EE: It defines the programming and deployment model for Web services in Java EE. It includes details of the client and server programming models, handlers (a similar concept to servlets filters), deployment descriptors, container requirements, and security (http://www.jcp.org/en/jsr/detail?id=109) and (http://www.jcp.org/en/jsr/detail?id=921).

Because interoperability is a key goal in Web services, an open, industry organization known as the Web Services Interoperability Organization (WS-I, http://ws-i.org/) has been created to allow interested parties to work together to maximize the interoperability between Web services implementations. WS-I has produced the following set of interoperability profiles:

WS-I Basic Profile 1.1
http://ws-i.org/Profiles/BasicProfile-1.1.html

WS-I Simple SOAP Binding Profile 1.0
http://ws-i.org/Profiles/SimpleSoapBindingProfile-1.0.html

WS-I Basic Security Profile 1.0
http://ws-i.org/Profiles/BasicSecurityProfile-1.0.html

WS-I Attachments Profile 1.0
http://ws-i.org/Profiles/AttachmentsProfile-1.0.html
ibm.com/redbooks