Publishing v1 UDDI v1

env.properties in the directory where run.shrun.bat is located. Local level properties for the BasicInquiry demos are loaded from the file: REGISTRY_HOME\demos\basic\publishing\v1\env.properties Windows: REGISTRY_HOMEdemosbasicpublishingv1env.properties UNIX: Table 2. Properties Used in the demos Description Default Value Name First users name demo_john uddi.demos.user.john.name First users password demo_john uddi.demos.user.john.password Second users name demo_jane uddi.demos.user.jane.name Second users password demo_jane uddi.demos.user.jane.password The publication Web service port URL http:localhost:8888registryuddipublishing uddi.demos.url.publishing The security Web service port URL http:localhost:8888registryuddisecurity uddi.demos.url.security Presentation and Functional Presentation This section describes the programming pattern used in all demos using the SaveBusiness demo as an example. You can find this demos source code in the file: REGISTRY_HOME\demos\basic\publishing\v1\src\demo\uddi\v1\publishing\SaveBusiness.java Windows: REGISTRY_HOMEdemosbasicpublishingv1srcdemouddiv1publishingSaveBusiness.java UNIX: The main method is easy to understand: 1. It gathers the users input: an optional publisher-assigned businessKey, an array of business entity names with their language codes, and the business description. 2. The next step is to get the security stub and authorize the user. The resulting authInfo string is a secret key passed in all requests. 3. Next, the Save_business object is created, filled, and passed to the saveBusiness method as a parameter. When successful, the BusinessDetail object is returned from the UDDI registry and printed. 4. The last step is to discard the authInfo string, so that no malicious user can use it to compromise a users account. String name = UserInput.readStringEnter business name, Marketing; String description = UserInput.readStringEnter description, Saved by SaveBusiness demo; System.out.println; UDDI_Security_PortType security = getSecurityStub; String authInfo = getAuthInfouser, password, security; Save_business save = createSaveBusinessbusinessKey, names, languageCodes, description, authInfo; BusinessDetail result = saveBusinesssave; printBusinessDetailresult; discardAuthInfoauthInfo, security; Page 645 Presentation and Functional Presentation The helper method, getSecurityStub returns the UDDI Security stub of the web service listening at the URL specified by the URL_SECURITY property. public static UDDI_Security_PortType getSecurityStub throws SOAPException { you can specify your own URL in property - uddi.demos.url.security String url = DemoProperties.getPropertyURL_SECURITY, http:localhost:8888registryuddisecurity; System.out.printUsing Security at url + url + ..; UDDI_Security_PortType security = UDDISecurityStub.getInstanceurl; System.out.println done; return security; } Similarly, the helper method getPublishingStub returns the UDDI Publication stub of the Web service listening at the URL specified by the URL_PUBLISHING property. public static UDDI_Publication_PortType getPublishingStub throws SOAPException { you can specify your own URL in property - uddi.demos.url.publishing String url = DemoProperties.getPropertyURL_PUBLISHING, http:localhost:8888registryuddipublishing; System.out.printUsing Publishing at url + url + ..; UDDI_Publication_PortType inquiry = UDDIPublishStub.getInstanceurl; System.out.println done; return inquiry; } The getAuthInfo method is used to authorize the user against the UDDI registry and to get the secret key authInfo. public static String getAuthInfoString userName, String password, UDDI_Security_PortType security throws InvalidParameterException, UDDIException { System.out.printLogging in ..; AuthToken authToken = security.get_authTokennew Get_authTokenuserName, password; System.out.println done; return authToken.getAuthInfo; } The discardAuthInfo method invalidates the secret key authInfo, so it cannot be reused. public static DispositionReport discardAuthInfoString authInfo, UDDI_Security_PortType security throws InvalidParameterException, UDDIException { System.out.printLogging out ..; DispositionReport dispositionReport = security.discard_authTokennew Discard_authTokenauthInfo; System.out.println done; return dispositionReport; } The createSaveBusiness method is used to create a new instance of the Save_business class and initialize it with values from parameters: public static Save_business createSaveBusinessString name, String description, String authInfo Page 646 Presentation and Functional Presentation throws InvalidParameterException { System.out.printlnname = + name; System.out.printlndescription = + description; BusinessEntity businessEntity = new BusinessEntity; businessEntity.setBusinessKey; businessEntity.setNamename; businessEntity.addDescriptionnew Descriptiondescription; Save_business save = new Save_business; save.addBusinessEntitybusinessEntity; save.setAuthInfoauthInfo; save.setGenericConstants.GENERIC_1_0; return save; } The UDDI API call save_business is performed in the saveBusiness method: public static BusinessDetail saveBusinessSave_business save throws UDDIException, SOAPException { UDDI_Publication_PortType publishing = getPublishingStub; System.out.printSave in progress ...; BusinessDetail businessDetail = publishing.save_businesssave; System.out.println done; return businessDetail; } The saved businessEntity is displayed by the printBusinessDetail method. One interesting aspect of the Oracle Service Registry client API is that each UDDIObject contains the toXML, which returns a human-readable formatted listing of the XML representation. public static void printBusinessDetailBusinessDetail businessDetail { System.out.println; BusinessEntityArrayList businessEntityArrayList = businessDetail.getBusinessEntityArrayList; int position = 1; for Iterator iterator = businessEntityArrayList.iterator; iterator.hasNext; { BusinessEntity entity = BusinessEntity iterator.next; System.out.printlnBusiness + position + : + entity.getBusinessKey; System.out.printlnentity.toXML; System.out.println; System.out.println; position++; } } Building and Running Demos This section shows how to build and run the Oracle Service Registry Basic Publishing demo set. Let us continue with our SaveBusiness demo. 1. Be sure that the demos are properly configured and the Oracle Service Registry is up and running. 2. Change your working directory to Page 647 Building and Running Demos REGISTRY_HOME\demos\basic\publishing\v1 Windows: REGISTRY_HOMEdemosbasicpublishingv1 UNIX: 3. Build all demos using: run.bat make Windows: .run.sh make UNIX: Note When compiling demos on Windows platforms, you may see the following text: subdirectory or file ..\..\common\.\build\classes already exists. This is expected and does not indicate a problem. 4. To get list of all available demos, run run.bat help Windows: .run.sh help UNIX: 5. The selected demo can be executed via the run command using the name of demo as a parameter. For example, to run the SaveBusiness demo, invoke run.bat SaveBusiness Windows: .run.sh SaveBusiness UNIX: The output of this demo will resemble the following: Running SaveBusiness demo... Saving business entity where Enter business name [Marketing]: Enter description [Saved by SaveBusiness demo]: Using Publishing at url https:mycomp.com:8443registryuddipublishing .. done Logging in .. done name = Marketing description = Saved by SaveBusiness demo Save in progress ... done Business 1 : 79596f30-a5a9-11d8-91cd-5c1d367091cd businessEntity businessKey=79596f30-a5a9-11d8-91cd-5c1d367091cd operator=Demo Operator authorizedName=demo_john xmlns=urn:uddi-org:api nameMarketingname descriptionSaved by SaveBusiness demodescription businessEntity Page 648 Building and Running Demos Logging out .. done 6. 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.

1.2. UDDI v2

• UDDI v2 Inquiry demos • UDDI v2 Publishing demos

1.2.1. Inquiry v2

The Oracle Service Registry basic inquiry demo set is used to demonstrate the Oracle Service Registry application programming interfaces capabilities and to teach the reader how to use this API to perform basic inquiry calls to a UDDI registry. The Oracle Service Registry basic inquiry demos cover inquiry aspects of the UDDI Version 2.0.4 Specification [http: www.oasis-open.orgcommitteesuddi-specdoctcspecs.htmuddiv2]. You will learn how to use the Oracle 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 Oracle Service Registry basic inquiry demo set contains following demos to assist you in learning the Oracle 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. FindRelatedBusiness Demonstrates how to construct and fill a Find_relatedBusiness object, get an Inquiry stub for the UDDI registry, perform a find_relatedBusiness 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. Page 649

1.2.1. Inquiry v2

Prerequisites and Preparatory Steps: Code We expect, that you have already installed the Oracle Service Registry registry and set the REGISTRY_HOME environment variable to its installation location. To run the Oracle Service Registrys demos, your registry must be running. 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: REGISTRY_HOME\demos\env.properties Windows: REGISTRY_HOMEdemosenv.properties UNIX: The values set during the installation of the Oracle Service Registry work out of box, and their modification affects all demos. If you need to redefine the value of some property 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 level properties for BasicInquiry demos are loaded in the file: REGISTRY_HOME\demos\basic\inquiry\v2\env.properties Windows: REGISTRY_HOMEdemosbasicinquiryv2env.properties UNIX: Table 3. Properties Used in Demos Description Default Value Name limit of data returned from registry 5 uddi.demos.result.max_rows the inquiry Web service port URL http:localhost:8888registryuddiinquiry uddi.demos.url.inquiry Presentation and Functional Presentation This section describes the programing pattern used in all demos using the FindTModel demo as an example. You can find its source code in the file: REGISTRY_HOME\demos\basic\inquiry\v2\src\demo\uddi\v2\inquiry\FindTModel.java Windows: REGISTRY_HOMEdemosbasicinquiryv2srcdemouddiv2inquiryFindTModel.java UNIX: The main method is straightforward. It gathers users 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.readStringEnter name, demo; Find_tModel find_tModel = createFindByTModelname, findQualifier; TModelList result = findTModelfind_tModel; printTModelListresult; The createFindTModel method is used to create new instance of the Find_tModel class and initialize it with values from parameters: public static Find_tModel createFindByTModelString name throws InvalidParameterException { System.out.printlnname = + name; Find_tModel find = new Find_tModel; find.setNamenew Namename; Page 650 Presentation and Functional Presentation