Version 16

    Service Registry/Repository


    There are many XML registries as well as specs provided for the same. Two of the most well known are ebXML and UDDI (Universal Description, Discovery, and Integration). Both registries would cover our registry needs. JAXR is an API which abstracts the XML registry used. See also this Java World article.




    We want to support the ability for you to use your own registry, so we will be using the JAXR APIs (see below). However by default we need our own registry. We want this registry to be as leight weight as possible. We do not want to have to pull in the entire SOAP stack for this if we don't need to. We'd like to make either local or rmi calls to our default registry.


    Candidate Repositories


    Two suitable open source candidates have been found that can serve as our repository


    JAXR - An Overview


    JAXR is a set of API that provides for accessing of various kinds of registries. The JAXR information model helps us in describing the content and metadata of the XML registries.


    The JAXR Components


    There are two parts to JAXR

    JAXR Client - Which uses the API to access the registry.

    JAXR Provider - Which is an implementation of the JAXR API to provide access to the specific registry provider.


    The basic interfaces for accessing the registry is


    Connection - This is the client session with the Registry Provider.


    RegistryService - This is obtained from the connection and helps the client to access the other interfaces.


    The Registry like any database contains information which can updated and selected. To do so there are two primary interfaces which are used


    BusinessQueryManager which allows the client to query on the Registry information.


    BusinessLifeCycleManager which allows the client to modify the registry information.



    The JAXR API can be downloaded from the SUN Webservices site and there is also an open source implementation called Scout. We need to have all the jars because JAXR uses other webservices API like SAAJ and JAXB. Once installed, we need to have the jaxr-api.jar and jaxr-impl.jar in our path. We would also need the JAXB and SAAJ API to be present as they are required by the JAXR implementation.


    Connection factories can be obtained by setting the properties. There are usually two URLs used. One one for querying and one for publishing or updating. Since we are using the JBossWS the URLs that we will be using are


    String queryURL = "http://localhost:8080/juddi/inquiry";

    String publishURL = "http://localhost:8080/juddi/publish";


    We then get a new instance of the Connection object from the ConnectionFactory and create a Connection.


    +factory = ConnectionFactory.newInstance();


    conn = factory.createConnection();+


    Once we get a connection we can get the RegistryService object from it and then get the BusinessQueryManager and the BusinessLifeCycleManger objects from the RegistryService.


    RegistryService rs = connection.getRegistryService();

    BusinessQueryManager bqm = rs.getBusinessQueryManager();

    BusinessLifeCycleManager blcm = rs.getBusinessLifeCycleManager();


    Now since we have these two objects we can run queries and updates on the registry



    The ;:usinessQueryManager interface provides a set of methods to query the registry. Some important menthods are findOrganizations, findAssociations and findServices.


    findOrganizations: This method takes Collections of various objects as their input. Using these objects, this method creates the query which is used to lookup the registry. These objects include

    1) The patterns to lookup. These are text Strings. We can use Wildcard characters here.

    2) The qualifiers used between the patterns (AND the patterns, OR the patterns etc.)

    3) The classification of the Organization. For e.g. the organization can be classified on what it sells or on where it is located.

    4) The specification of the RegistryObjects to look up.

    5) The ExternalLinks which are URI to resources outside the Registry.

    6) The ExternalIdentifiers to the Registry, which may be the SSN or perhaps the

    All this put together we can query the registry by calling this method.

    BulkResponse bulkResponse = bqm.findOrganizations(findQualifiers, namePatterns, classfications, specifications, externalIdentifiers, externalLinks);

    Collection orgs = response.getCollection();


    Using other criteria for searches

    There are various classification schemes and identifiers present for various organizations. If we have knowledge of these taxonomies we can query on the registry with that data.


    If the service offiers data which is in the form of WSDL then we can use the same in the form of specifications. It is actually the concept which is used a proxy for holding information about the specification. The BusinessQueryManager provides a method, findConcepts which we can use to search a registry based on the WSDL Specification.


    We can also search for services and bindings using the findServices and the findServiceBindings. Once we locate a service which we need to use we can invoke the same using the WebServices API which is provided by Java.


    Besides these we can query on Associations and Classification Schemas as well just to name a few.


    Creating Organizations

    One of the complex objects on the JAXR API is the Organization object. This usually has a name, a description and a key Object to identify this Organization. The keys are never created by the user but are returned by the registry from the method creating the Organization. The Organization also contains classifications and other other details about the itself like email address, contacts etc.


    We use the BusinessLifeCycleManager to call the methods to create objects and store them in the Registry.


    +Organization organization = blcm.createOrganization(s);

    String intString = blcm.createInternationalString("An organization to test?");



    As above we can add other attributes to the Organization like contacts and Classifications.


    Creating Services

    One of the most essential use of a Registry is that different systems use it to offer their Services. Its not essential to just have the service. We also require the ServiceBinding to be present for the service. These ServiceBindings provide the access to the Service. The JAXR API provide an easy way to add not just Services, but their bindings as well.


    Similar to Organizations, Services have names and keys as well. And they are created by the BusinessLifeCycleManager


    +InternationalString string = blcm.createInternationalString("New Service Here"));

    Service service = blcm.createService(s);

    string = blcm.createInternationalString("This Service needs a description too?");



    ServiceBinding binding = blcm.createServiceBinding();

    string = blcm.createInternationalString("Service binding huh?");




    Once Organizations, Services and ServiceBindings are saved they can now be published using the save methods. These methods update the registry on the provider.