Download





The J2EE Web Service APIs

Parts IV through VI of this book cover the four J2EE Web Service APIs: JAX-RPC, SAAJ, JAXR, and JAXP. These are the APIs you will need to understand if you want to implement Web service applications using the J2EE platform. Perhaps the most important Web service API is JAX-RPC, which is used to implement J2EE Web service clients and endpoints (services). A substantial portion of this book (seven chapters) covers JAX-RPC.

1 JAX-RPC

You can think of JAX-RPC (Java API for XML-based RPC) as Java RMI over SOAP. While this characterization provides a good vantage point for learning about JAX-RPC, it's not the complete story. You can obtain a good understanding of JAX-RPC only by studying it in detail. Part IV (Chapters 915) provides detailed coverage of JAX-RPC.

JAX-RPC is divided into two parts: a set of client-side APIs, and a set of server-side components, called endpoints. The client-side APIs allow you to communicate with Web service endpoints hosted on some other platform. For example, you can use one of the client-side APIs to send SOAP messages to a VB.NET or an Apache Axis Web service. The client-side APIs can be used from standalone Java applications or from J2EE components like servlets, JSPs, or EJBs. There are three client-side APIs: generated stub, dynamic proxy, and DII (Dynamic Invocation Interface). The generated stub is the one you will use the most, and its semantics closely resemble those of Java RMI. The dynamic proxy API also follows many of the Java RMI semantics, but is used less often. The DII is a very low-level API used primarily by vendor tools, but can also be employed by Web services developers if necessary.

The server-side components include the JAX-RPC service endpoint (JSE) and the EJB endpoint. The JSE component is actually a type of servlet that has been adapted for use as a Web services component. It's very easy to implement, yet it has access to the full array of services and interfaces common to servlets. The EJB endpoint is simply a type of stateless session EJB that has been adapted for use as a Web service endpoint. The EJB endpoint provides all the transactional and security features of a normal stateless session bean, but it's specifically designed to process SOAP requests.

There are currently two versions of JAX-RPC, 1.0 and 1.1. Version 1.0 is used with J2EE 1.3, while version 1.1 is used with J2EE 1.4. The primary difference between 1.0 and 1.1 is that 1.1 is required to conform with the BP. Because this book focuses on BP-conformant applications, version 1.0 is not covered in this book.

2 SAAJ

SAAJ (SOAP with Attachments API for Java) is a low-level SOAP API that complies with SOAP 1.1 and the SOAP Messages with Attachments specification. SAAJ allows you to build SOAP messages from scratch as well as read and manipulate SOAP messages. You can use it alone to create, transmit, and process SOAP messages, but you're more likely to use it in conjunction with JAX-RPC. In JAX-RPC, SAAJ is used primarily to process SOAP header blocks (the SOAP message meta-data). Chapter 13 covers the SAAJ API in detail.

Although the BP does not support SOAP Messages with Attachments, J2EE 1.4 requires SwA, so it's covered in Appendix F: SAAJ Attachments.

3 JAXR

JAXR (Java API for XML Registries) provides an API for accessing UDDI registries. It simplifies the process of publishing and searching for Web service endpoints. JAXR was originally intended for ebXML registries, a standard that competes with UDDI, but was adapted for UDDI and works pretty well in most cases.

JAXR has a set of business-domain types like Organization, PostalAddress, and Contact as well as technical-domain types like ServiceBinding, ExternalLink, and Classification. These domain models map nicely to UDDI data types. JAXR also defines APIs for publishing and searching for information in a UDDI registry. There is only one version of JAXR, version 1.0, which is the subject of Part V (Chapters 1619) of this book.

4 JAXP

JAXP (Java API for XML Processing) provides a framework for using DOM 2 and SAX2, standard Java APIs that read, write, and modify XML documents.

DOM 2 (Document Object Model, Level 2) is a Java API that models XML documents as trees of objects. It contains objects that represent elements, attributes, values, and so on. DOM 2 is used a lot in situations where speed and memory are not factors, but complex manipulation of XML documents is required. DOM 2 is also the basis of SAAJ 1.1.

SAX2 (Simple API for XML, version 2) is very different in functionality from DOM 2. When a SAX parser reads an XML document, it fires events as it encounters start and end tags, attributes, values, etc. You can register listeners for these events, and they will be notified as the SAX2 parser detects changes in the XML document it is reading.

JAXP comes in several versions including 1.1, 1.2, and 1.3. Version 1.3 is very new and is not supported by J2EE 1.4 Web Services. Instead, J2EE 1.4 requires support for JAXP 1.2, which is the subject of Part VI (Chapters 20 and 21) in this book.


     Python   SQL   Java   php   Perl 
     game development   web development   internet   *nix   graphics   hardware 
     telecommunications   C++ 
     Flash   Active Directory   Windows