The BEA AquaLogic Service Registry basic inquiry demo set is used to demonstrate the BEA AquaLogic Service Registry application programming interface's capabilities and to teach the reader how to use this API to perform basic inquiry calls to a UDDI registry. This documentation covers the UDDI Version 1 Specification.
You will learn how to use the BEA AquaLogic Service Registry client API to contact and get information from a UDDI registry over a SOAP interface. There is one demo for each UDDI call, from find_business to get_tModelDetail.
The BEA AquaLogic Service Registry basic inquiry demo set contains following demos to assist you in learning the BEA AquaLogic Service Registry client API.
FindBinding Demonstrates how to construct and fill the Find_binding object, get an Inquiry stub for the UDDI registry, perform a find_binding call, and display the results.
FindBusiness Demonstrates how to construct and fill a Find_business object, get an Inquiry stub for the UDDI registry, perform a find_business call and display the results.
FindService Demonstrates how to construct and fill a Find_service object, get an Inquiry stub for the UDDI registry, perform a find_service call and display the results.
FindTModel Demonstrates how to construct and fill a Find_tModel object, get an Inquiry stub for the UDDI registry, perform a find_tModel call and display the results.
GetBindingDetail Demonstrates how to create a Get_bindingDetail object, set the bindingKey of the bindingTemplate to be fetched, get an Inquiry stub for the UDDI registry, perform a get_bindingDetail call, and display the result.
GetBusinessDetail Demonstrates how to create a Get_businessDetail object, set the businessKey of the businessEntity to be fetched, get an Inquiry stub for the UDDI registry, perform a get_businessDetail call, and display the result.
GetServiceDetail Demonstrates how to create a Get_serviceDetail object, set the serviceKey of the business service to be fetched, get an Inquiry stub for the UDDI registry, perform a get_serviceDetail call, and display the result.
GetTModeDetail Demonstrates how to create a Get_tModelDetail object, set the tModelKey of the tModel to be fetched, get an Inquiry stub for the UDDI registry, perform a get_tModelDetail call, and display the result.
We expect, that you have already installed the BEA AquaLogic Service Registry and set the REGISTRY_HOME environment variable to its installation location.
To run the BEA AquaLogic Service Registry's demos, your UDDI registry must be running. To start the registry, execute the serverstart script:
Windows: | %REGISTRY_HOME%\bin\serverstart.bat |
UNIX: | $REGISTRY_HOME/bin/serverstart.sh |
It is necessary to configure the demos. The configuration system has two levels: global and local. The properties defined at the global level may be overwritten at the local level. The global properties are located in the file:
Windows: | %REGISTRY_HOME%\demos\env.properties |
UNIX: | $REGISTRY_HOME/demos/env.properties |
The values set during the installation of the BEA AquaLogic Service Registry work out of box, and their modification affects all demos. If you need to redefine a property's value for a single demo (that is, at the local level), edit the file env.properties in the directory where run.bat (run.sh) is located. Local properties for Basic/Inquiry demos are loaded in the file:
Windows: | %REGISTRY_HOME%\demos\basic\inquiry\v1\env.properties |
UNIX: | $REGISTRY_HOME/demos/basic/inquiry/v1/env.properties |
This section describes programing pattern used in all demos using the FindTModel demo as an example. You can find its source code in the file:
Windows: | %REGISTRY_HOME%\demos\basic\inquiry\src\demo\uddi\v1\inquiry\FindTModel.java |
UNIX: | $REGISTRY_HOME/demos/basic/inquiry/src/demo/uddi/v1/inquiry/FindTModel.java |
The main method is straightforward. It gathers user's input (tModel name), calls a method to initialize the Find_tModel object, executes the find_tModel UDDI call, and displays the list of found tModels:
String name = UserInput.readString("Enter name", "demo%"); Find_tModel find_tModel = createFindByTModel(name, findQualifier); TModelList result = findTModel(find_tModel); printTModelList(result);
The createFindTModel() method is used to create a new instance of the Find_tModel class and initialize it with values from parameters:
public static Find_tModel createFindByTModel(String name) throws InvalidParameterException { System.out.println("name = " + name); Find_tModel find = new Find_tModel(); find.setName(name); find.setMaxRows(new Integer(MAX_ROWS)); find.setGeneric(Constants.GENERIC_1_0); return find_tModel; }
The helper method getInquiryStub() returns the UDDI Inquiry stub of the web service listening at the URL specified in the URL_INQUIRY property.
public static InquireSoap getInquiryStub() throws SOAPException { // you can specify your own URL in property - uddi.demos.url.inquiry String url = DemoProperties.getProperty(URL_INQUIRY, "http://localhost:8080/uddi/inquiry"); System.out.print("Using Inquiry at url " + url + " .."); InquireSoap inquiry = UDDIInquiryStub.getInstance(url); System.out.println(" done"); return inquiry; }
The UDDI API call find_tModel is performed in the method findTModel:
public static TModelList findTModel(Find_tModel find_tModel) throws UDDIException, SOAPException { InquireSoap inquiry = getInquiryStub(); System.out.print("Search in progress .."); TModelList tModelList = inquiry.find_tModel(find_tModel); System.out.println(" done"); return tModelList; }
The list of found tModels is printed with the method printTModelList. One interesting aspect of the BEA AquaLogic Service Registry client API is that each UDDIObject contains the method toXML(), which returns a human-readable, formatted listing of its XML representation.
public static void printTModelList(TModelList tModelList) { System.out.println(); TModelInfoArrayList tModelInfoArrayList = tModelList.getTModelInfoArrayList(); if (tModelInfoArrayList==null) { System.out.println("Nothing found"); return; } int position = 1; for (Iterator iterator = tModelInfoArrayList.iterator(); iterator.hasNext();) { TModelInfo tModelTemplate = (TModelInfo) iterator.next(); System.out.println("TModel "+position+" : "+tModelTemplate.getTModelKey()); System.out.println(tModelTemplate.toXML()); System.out.println(); System.out.println("********************************************************"); position++; } }
This section shows how to build and run the BEA AquaLogic Service Registry Basic Inquiry demo set. Our example continues with the FindTModel demo.
Be sure that the demos are properly configured and the BEA AquaLogic Service Registry is up and running.
Change your working directory to:
Windows: | %REGISTRY_HOME%\demos\basic\inquiry\v1 |
UNIX: | $REGISTRY_HOME/demos/basic/inquiry/v1 |
Build all demos using:
Windows: | run.bat make |
UNIX: | ./run.sh make |
![]() | Note |
---|---|
When compiling demos on Windows platforms, you may see the following text: A subdirectory or file ..\..\common\.\build\classes already exists. This is expected and does not indicate a problem. |
To get list of all available demos, run
Windows: | run.bat help |
UNIX: | ./run.sh help |
Run a selected demo by executing the run command with the name of the demo as a parameter. For example, to run the FindTModel demo, invoke
Windows: | run.bat FindBinding |
UNIX: | ./run.sh FindBinding |
The output of this demo will resemble the following:
Running FindTModel demo... ************************************************************************** *** BEA AquaLogic Service Registry Demo - FindTModelDemo *** ************************************************************************** Searching for tModel where Enter name [demo%]: name = demo% Using Inquiry at url http://mycomp.com:8080/uddi/inquiry .. done Search in progress .. done TModel 1 : uuid:13aee5be-8531-343c-98f8-d2d3a9308329 <tModelInfo tModelKey="uuid:13aee5be-8531-343c-98f8-d2d3a9308329" xmlns="urn:uddi-org:api_v1"> <name>demo:departmentID</name> </tModelInfo> ******************************************************** TModel 2 : uuid:8af5f49e-e793-3719-92f3-6ab8998eb5a9 <tModelInfo tModelKey="uuid:8af5f49e-e793-3719-92f3-6ab8998eb5a9" xmlns="urn:uddi-org:api_v1"> <name>demo:hierarchy</name> </tModelInfo> ******************************************************** TModel 3 : uuid:5c1d5d80-a4d4-11d8-91cd-5c1d367091cd <tModelInfo tModelKey="uuid:5c1d5d80-a4d4-11d8-91cd-5c1d367091cd" xmlns="urn:uddi-org:api_v1"> <name>Demo identifier</name> </tModelInfo> ********************************************************
To rebuild demos, execute run.bat clean (./run.sh clean) to delete the classes directory and run.bat make (./run.sh make) to rebuild the demo classes.