Service Registry 3 2005Q4 Developer's Guide

Retrieving the Services and Service Bindings for an Organization

Most organizations offer services. JAXR has methods that retrieve the services and service bindings for an organization.

A Service object has all the attributes of other registry objects. In addition, it normally has service bindings, which provide information about how to access the service. A ServiceBinding object, along with its other attributes, normally has an access URI and a specification link. The specification link provides the linkage between a service binding and a technical specification that describes how to use the service through the service binding. A specification link has the following attributes:

You can use the Service.getProvidingOrganization method to retrieve the organization that provides a service, and you can use the ServiceBinding.getService method to retrieve the service for a service binding.

The following code fragment retrieves the services for the organization org. Then it retrieves the service bindings for each service and, for each service binding, its access URI and specification links.

Collection services = org.getServices();
Iterator svcIter = services.iterator();
while (svcIter.hasNext()) {
    Service svc = (Service) svcIter.next();
    System.out.println(" Service name: " + getName(svc));
    System.out.println(" Service description: " +
        getDescription(svc));

    Collection serviceBindings = svc.getServiceBindings();
    Iterator sbIter = serviceBindings.iterator();
    while (sbIter.hasNext()) {
        ServiceBinding sb = (ServiceBinding) sbIter.next();
        System.out.println("  Binding name: " +
            getName(sb));
        System.out.println("  Binding description: " +
            getDescription(sb));
        System.out.println("  Access URI: " +
            sb.getAccessURI());

        Collection specLinks = sb.getSpecificationLinks();
        Iterator slIter = specLinks.iterator();
        while (slIter.hasNext()) {
            SpecificationLink sl =
                 (SpecificationLink) slIter.next();
            RegistryObject ro = sl.getSpecificationObject();
            System.out.println("Specification link " +
                "object of type " + ro.getObjectType());
            System.out.println("Usage description: " +
                sl.getUsageDescription().getValue());
            Collection ups = sl.getUsageParameters();
            Iterator upIter = ups.iterator();
            while (upIter.hasNext()) {
                String up = (String) upIter.next();
                System.out.println("Usage parameter: " +
                     up);
             }
        }
    }
}

The example Retrieving Organization Attributes: Example also displays the services and service bindings for the organizations it finds.

Services often exist independent of an organization. You can search for services directly using the BusinessQueryManagerImpl.findObjects method.