- Web Services Vision
- Inside the JWSDP
- Testing Tools
- Summary
Inside the JWSDP
At first glance, the many different APIs and tools available with the JWSDP may seem like an alphabet soup of new and older Java technologies. However, each serves a distinct purpose in integrating Java server-based functionality with the world of Web Services. A look at the major pieces that compose the JWSDP can help to understand the interconnection zone between the tightly coupled computing model of J2EE and the asynchronous, Web-centric computing milieu of the Web.
The JWSDP download, available at http://java.sun.com/webservices/downloads/webservicespack.html, comes with a collection of different technologies that include the following:
JAXP: Java API for XML Processing
JAX-RPC: Java API for XML-Based RPC
JAXM: Java API for XML Messaging
JAXR: Java API for XML Registries
Java Servlet 2.3
JavaServer Pages (JSP 1.2) and the JavaServer Pages Standard Tag Library (JSTL)
Apache Tomcat 4.1-dev Container (Tomcat) the reference implementation of the JSP 1.2
Java WSDP Registry Server
The JWSDP also includes well-written, comprehensive documentation that is worth the download, even if you aren't immediately interested in building Java-based Web Services.
Figure 1 illustrates the roles played the various pieces of the JWSDP.
Figure 1 Java Web Services Pack (JWSDP).
Servlets and JSP technology
Let's begin by looking at Servlets and Java Server Pages (JSPs), the two Java front-end technologies sitting at the boundary between Java servers and the Web. Outside the Web Services world, Servlets and JSPs are the technologies of choice for handling HTTP requests and for building dynamic HTML responses. Servlets support a programmatic approach to incoming Web requests, whereas JSPs (which actually are compiled into Servlets) begin with HTML and provide hooks into Java Bean components to create dynamic content, often via database access.
In the Web Services world, Servlets and JSPs act as the entry point for clients connecting to Web services over HTTP. In the conventional Web, requests come from humans. In the Web Services world, the HTTP requests come from other servers. With Web Services, the task of Servlets and JSPs is to route incoming requests, most commonly to an application running in a J2EE container. However, handling an XML-based Web Service request and generating an XML response requires Java-based support for working with XML and XML messages. That's the role of the Java XML Pack.
Java XML Pack
Java XML Pack is a collection of XML technologies, provided in the JWSDP that allows Java developers to work with industry standards for XML. Included in the Java XML Pack is software to work with SOAP messages (JAXM), process XML data (JAXP), communicate with registries (JAXR), and handle remote procedure calls (XML-RPC). The inclusion of the entire Java XML Pack in the JWSDP as a single download gives the Java developer all the tools needed to integrate XML functionality into Java-based Web Services applications. Let's look at the role of each API.
Java API for XML Messaging (JAXM)
JAXM is the key API for sending and receiving XML messages based on the Simple Object Access Protocol (SOAP) 1.1 and SOAP with attachments. Because SOAP messages are fundamentally one-way transmissions between a sender and receiver, additional layering is necessary to support more complex patterns of request and response. JAXM provides that layering through a Java interface that defines the behavior of JAXM entities called providers, which sit on opposite ends of a connection and communicate with each other on behalf of a sender and receiver. The advantages of using JAXM messaging providers include the following:
One-way asynchronous messaging
Routing of messages to more than one party
Reliable messaging, including guaranteed delivery
JAXM also includes several different ways to generate XML content for SOAP messages. Using the capabilities of JAXP (see the next section), JAXM is able to acquire XML directly from a stream or from a SAX or DOM processing source that contains content as well as instructions for transforming it into an XML document.
Java API for XML Processing (JAXP)
The role of JAXP is to help process XML as it arrives in incoming messages, and to help prepare XML for delivery to clients. With JAXP, developers have the option of processing XML with either the event-based SAX model or with the tree-based DOM. JAXP also provides APIs for transforming XML to other formats using XSLT, the XML transform technology. In handling XML-based Web Services, JAXP is the foundational link for processing the XML data arriving in XML-based SOAP packets.
Java API for XML Registries (JAXR)
Registries play an important role in Web Services as a centralized place to store information about available services. JAXR is the API that provides a uniform and standard Java API for interacting with two important registries: the Universal Description Discovery and Integration (UDDI) registry and the ebXML Registry/Repository. Each registry provides a profile of information about companies and their Web Services by using a well-defined schema and messaging format. JAXR permits Java developers to access registry information in a way that hides low-level details, including schema and messaging formats.
Java API for XML-Based RPC (JAX-RPC)
JAX-RPC enables Java developers to build applications and services that incorporate remote procedure call (RPC) functionality. JAX-RPC makes it possible to embrace the heterogeneity inherent in Web Services by supporting communication with services deployed on different platforms and written in different languages. Technologies such as CORBA, RMI, and DCOM have successfully implemented RPC, but on top of a transport layer that is not immediately interoperable with other layers. In using JAX-RPC, Java developers can rapidly achieve Web Services interoperability based on widely adopted Web standards and protocols.
In the Web Services world, RPC is crucial because what a Web Service really means is the execution of code in a distributed environment. In the XML world, developers represent RPC calls using an XML-based protocol such as one that conforms to the Simple Object Access Protocol (SOAP) 1.1 specification. One of the important aspects of JAX-RPC is its capacity to hide much of the detail associated with SOAP messaging.