SCDJWS Study Guide: JAXR
A Web service is a software system designed to support interoperable machine-to-machine interaction over a network. It has an interface described in a machine-processable format (specifically WSDL). Other systems interact with the Web service in a manner prescribed by its description using SOAP messages, typically conveyed using HTTP with an XML serialization in conjunction with other Web-related standards. [Web Services Architecture]
The Web Services world is one in which clients and services find each other and connect without any explicit prior knowledge. In this open Web world, registries play a critical role in client discovery and lookup, as well as service provider registration. When Web Services are written as Java server-based applications, developers need a way to register their services and to do repository search and lookup.
The recent release of the Java Web Services Developer Pack (JWSDP)—a collection of tools and APIs for building Web Services based on the Java 2 Enterprise Edition (J2EE)—includes an API tailored for registry interaction. JAXR enables Java software programmers to use a single, easy-to-use abstraction API to access a variety of XML registries. Simplicity and ease of use are facilitated within JAXR by a unified JAXR information model, which describes content and metadata within XML registries.
The Java API for Registries (JAXR) provides a convenient way for Java developers to use a single simple API to access a variety of XML registries including UDDI and ebXML. JAXR provides rich metadata capabilities for classification and association, as well as rich query capabilities. As an abstraction-based API, JAXR gives developers the ability to write registry client programs that are portable across different target registries.
JAXR does not define a new registry standard. Instead, this standard Java API performs registry operations over a diverse set of registries and defines a unified information model for describing registry contents. Regardless of the registry provider accessed, your programs use common APIs and a common information model. The JAXR specification defines a general-purpose API, allowing any JAXR client to access and interoperate with any business registry accessible via a JAXR provider. In this sense, JAXR provides a Write Once, Run Anywhere API for registry operations, simplifying Web services development, integration, and portability.
A JAXR provider implements two main packages:
- javax.xml.registry, which consists of the API interfaces and classes that define the registry access interface.
- javax.xml.registry.infomodel, which consists of interfaces that define the information model for JAXR. These interfaces define the types of objects that reside in a registry and how they relate to each other. The basic interface in this package is the RegistryObject interface.
The most basic interfaces in the javax.xml.registry package are
- Connection. The Connection interface represents a client session with a registry provider. The client must create a connection with the JAXR provider in order to use a registry.
- RegistryService. The client obtains a RegistryService object from its connection. The RegistryService object in turn enables the client to obtain the interfaces it uses to access the registry.
The primary interfaces, also part of the javax.xml.registry package, are
- QueryManager and BusinessQueryManager, which allow the client to search a registry for information in accordance with the javax.xml.registry.infomodel interfaces. An optional interface, DeclarativeQueryManager, allows the client to use SQL syntax for queries. The ebXML provider for the Registry implements DeclarativeQueryManager.
- LifeCycleManager and BusinessLifeCycleManager, which allow the client to modify the information in a registry by either saving it (updating it) or deleting it.
When an error occurs, JAXR API methods throw a JAXRException or one of its subclasses.
Many methods in the JAXR API use a Collection object as an argument or a returned value. Using a Collection object allows operations on several registry objects at a time.