Chapter 7. JAXR
JAX-RPC and SAAJ are enabling technologies that allow companies to create electronic business applications that exchange information using XML and SOAP. WSDL (see Chapter 5) is the means by which a developer finds out about the interface provided by a web service. As you saw in Chapter 6, once you have a WSDL definition for a service, you can quickly create the client-side stubs that an application needs in order to communicate with it using JAX-RPC. The remaining question is, given that your business needs to find a provider for a specific service, how do you go about locating businesses that offer that service, evaluate their offerings, and, if appropriate, fetch the WSDL definition for the service itself? The answer lies in the XML-based registries that are currently being established on the Internet.
A registry contains information that allows businesses to discover and make use of the services of potential corporate electronic partners . A business might want to deal directly with another party (purchasing components or other services from that company), or perhaps, it may intend to add value to the other party's offerings ”for example, by providing a specialized interface to the other's web service, such as the one offered by Amazon.com.
A provider company submits an entry to a registry and categorizes it in various ways that will make it easier to find. The submitting company might include in its registry entries links to technical specifications that describe its service at the level required by a potential implementor of an application client, or it might include marketing information for the consumption of management-level decision makers . The enquiring company searches the registry for information using various criteria, such as name hints (thus treating the registry as a source of White Pages information), categories of interest (a Yellow Pages search), or a geographical location (a Green Pages search). The information that it retrieves can be inspected and compared with what is available from other sources. Finally, if a business agreement is reached, the client company retrieves the WSDL definition for the service that it needs to use, which is typically also available through the registry, and uses that as the basis for creating a SAAJ- or JAX-RPC-based application client.
7.1 UDDI and ebXML Registries
There are currently two different XML-based registry standards being developed:
- The UDDI Version 2.0 Registry
The Universal Description, Discovery, and Integration (UDDI) registry standard was originally created by IBM, Microsoft, and Ariba, but the technical committee that is responsible for its ongoing development now has more than 50 members . The UDDI registry is intended primarily for the publication of metadata relating to web services.
- The ebXML Registry/Repository
The ebXML Registry/Repository standard was created by OASIS and is aimed at the e-commerce market. It is currently more feature-rich than UDDI, and also provides a repository, which allows companies to store documents and other data in the registry, as well as links to information that is kept elsewhere.
There is a public production UDDI business registry maintained by IBM, Microsoft, and SAP. Businesses can register with any of these UDDI operator companies to enter and update their details. Changes made in one operator company's copy of the registry are automatically propagated to those of the other operators so that they can be seen by users of any of the operators' views and thus give the appearance that there is a single, global registry. The registry offers an interface that allows you to submit queries from your web browser using one of the following URLs:
The business search page provided at the IBM web site is shown in Figure 7-1.
Figure 7-1. Searching for a business in a UDDI registry
This page allows you to locate business entries based on criteria such as the company name (which can include a wildcard character) or categories that might have been applied by the company to its registry entry, such as a geographical location qualifier. If, for example, you perform a case-insensitive search for businesses whose name starts with the string "amazon," you would probably get two results, as shown in Figure 7-2.
Figure 7-2. The results of a business search in the UDDI registry
A business may offer one or more services, the descriptions of which can be obtained by clicking the Services link. In the case of the entry for Amazon.com, this leads to another page, shown in Figure 7-3. As you can see, Amazon.com provides one web service, which describes itself as a fee-earner for developers that create application clients that are subsequently used to purchase items from the online store. To find out more, you select the link in the Service Name column, which fetches the actual service details, as shown in Figure 7-4. Among the information on this page is an Access URL , which supplies the location of the service's WSDL definition, from which you can create the stubs required to access the service using JAX-RPC.
Figure 7-3. Services offered by Amazon.com
Figure 7-4. Service details for Amazon.com
This UDDI registry is intended for production use and contains real business information. The UDDI operators also provide test registries that can be used during development and testing, one of which can be found at http://uddi.ibm.com/testregistry/registry.html. While registry searching can be performed anonymously, you'll typically need to register in order to be able to update a registry.
There is also a test version of the ebXML registry/repository available for public use at http://registry.csis.hku.hk:8201/ebxmlrr/registry. At the time of this writing, this registry does not have a browser-based interface. Instead, you have to download and install a Java client that can be used to access the registry. Details of this client are provided in the next section.