background image

Publishing an Organization

<< Adding Services and Service Bindings | WSDL document >>
<< Adding Services and Service Bindings | WSDL document >>
190
J
AVA
API
FOR
XML R
EGISTRIES
// Add service to services, then add services to organization
services.add(service);
org.addServices(services);
Publishing an Organization
The primary method a client uses to add or modify organization data is the
saveOrganizations
method, which creates one or more new organizations in a
registry if they did not exist previously. If one of the organizations exists but
some of the data have changed, the
saveOrganizations
method updates and
replaces the data.
After a client populates an organization with the information it wants to make
public, it saves the organization. The registry returns the key in its response, and
the client retrieves it.
// Add organization and submit to registry
// Retrieve key if successful
Collection<Organization> orgs = new ArrayList<Organization>();
orgs.add(org);
BulkResponse response = blcm.saveOrganizations(orgs);
Collection exceptions = response.getException();
if (exceptions == null) {
System.out.println("Organization saved");
Collection keys = response.getCollection();
Iterator keyIter = keys.iterator();
if (keyIter.hasNext()) {
Key orgKey = (Key) keyIter.next();
String id = orgKey.getId();
System.out.println("Organization key is " + id);
}
}
Publishing a Specification Concept
A service binding can have 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 docu-
ment), you create a
Concept
object and then add the URL of the WSDL docu-
ment to the
Concept
object as an
ExternalLink
object. The following code
fragment shows how to create a concept for the WSDL document associated
with the simple web service example in Creating a Simple Web Service and Cli-