Service Registry 3 2005Q4 Developer's Guide

Creating Services and Service Bindings

Most organizations publish themselves to a registry to offer services, so JAXR has facilities to add services and service bindings to an organization.

You can also create services that are not attached to any organization.

Like an Organization object, a Service object has a name, a description, and a unique key that is generated by the Registry when the service is registered. A Service object can also have classifications.

In addition to the attributes common to all objects, a service also commonly has service bindings, which provide information about how to access the service. A ServiceBinding object normally has a description, 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 by using the service binding.

The following code fragment shows how to create a collection of services, add service bindings to a service, and then add the services to the organization. The code fragment specifies an access URI but not a specification link. Because the access URI is not real and because JAXR by default checks for the validity of any published URI, the binding sets its validateURI attribute to false.

// Create services and service
Collection services = new ArrayList();
Service service = blcm.createService("My Service Name");
InternationalString is =
     blcm.createInternationalString("My Service Description");
service.setDescription(is);

// Create service bindings
Collection serviceBindings = new ArrayList();
ServiceBinding binding =
     blcm.createServiceBinding();
is = blcm.createInternationalString("My Service Binding " +
     "Name"));
binding.setName(is);
is = blcm.createInternationalString("My Service Binding " +
    "Description");
binding.setDescription(is);
// allow us to publish a fictitious URI without an error
binding.setValidateURI(false);
binding.setAccessURI("http://TheCoffeeBreak.com:8080/sb/");
...
serviceBindings.add(binding);

// Add service bindings to service
service.addServiceBindings(serviceBindings);

// Add service to services, then add services to organization
services.add(service);
org.addServices(services);

A service binding normally has a technical specification that describes how to access the service. An example of such a specification is a WSDL document. To publish the location of a service’s specification (if the specification is a WSDL document), you create a SpecificationLink object that refers to an ExtrinsicObject. For details, see Storing Items in the Repository.

(This mechanism is different from the way you publish a specification’s location to a UDDI registry: for a UDDI registry you create a Concept object and then add the URL of the WSDL document to the Concept object as an ExternalLink object.)