The objective of this lesson is to learn how to save a business definition in a UDDI registry.
The UDDI Programmer's API defines the messages to be used to save information in an UDDI registry. Among them, the save_business message studied in this lesson allows saving business entity information. The UDDI registry reply is a businessDetail message returning the business entity information as it has been saved in the UDDI registry.
We first create an UDDIProfile and set, in this example, the publishing URL to Microsoft's UBR. We will also use UDDI 2.0 for the interactions with the UDDI registry:
UDDIProfile profile = new UDDIProfile();
profile.setProperty("inspireit.uddi.publishing.url","http://uddi.microsoft.com/publish");
profile.setProperty("inspireit.uddi.version","2.0");
An UDDIPublisher to publish to the UDDI registry can be instantiated using the static getPublisher(UDDIProfile) method:
UDDIPublisher publisher = UDDIPublisher.getPublisher(profile);
UDDIPublisher comes with a set of methods to publish information to UDDI registries. To publish business entity information, we use one of the available saveBusiness() methods. For example:
BusinessEntity businessEntity = ... // the business entity to publish
BusinessDetail businessDetail = publisher.saveBusiness(businessEntity);
The UDDIPublisher methods all throw RemoteException and UDDIException , not catched here for clarity. The returned BusinessDetail provides a complete view on the way the business entity (or business entities) has (or have) been saved, such as the business key(s) that has (or have) been computed to uniquely tag the information in the UDDI registry.
The following code shows how the returned BusinessDetail can be decomposed at the level of granularity required to access the business key information:
BusinessEntitys businessEntitys = businessDetail.getBusinessEntitys();
BusinessEntity _businessEntitys[] = businessEntitys.toArray();
for(int i=0; i< _businessEntitys.length; i++) {
BusinessEntity businessEntity = _businessEntitys[i];
BusinessKey businessKey = businessEntity.getBusinessKey();
System.out.println("BusinessKey #" + i + ": " + businessKey);
}
|
|
(c) INSPIRE IT, 2003 | Send us your feedback: developers@ruddi.biz