Publishing v3 UDDI v3

DeleteService Demonstrates how to construct and fill the Delete_service object, get Publishing stub for the UDDI registry, get an authToken, and perform the delete_service call. DeleteTModel Demonstrates how to construct and fill the Delete_tModel object, get a Publishing stub for the UDDI registry, get an authToken, and perform the delete_tModel call. GetAssertionStatusReport Demonstrates how to construct and fill the Get_assertionStatusReport object, get a Publishing stub for the UDDI registry, get an authToken, and perform the get_assertionStatusReport call. GetPublisherAssertions Demonstrates how to construct and fill the Get_publisherAssertions object, get a Publishing stub for the UDDI registry, get an authToken, and perform the get_publisherAssertions call. GetRegisteredInfo Demonstrates how to construct and fill the Get_registeredInfo object, get a Publishing stub for the UDDI registry, get an authToken, and perform the get_registeredInfo call. SaveBinding Demonstrates how to construct and fill the Save_binding object, get a Publishing stub for the UDDI registry, get an authToken, and perform the save_binding call. SaveBusiness Demonstrates how to construct and fill the Save_business object, get a Publishing stub for the UDDI registry, get an authToken, and perform the save_business call. SaveService Demonstrates how to construct and fill the Save_service object, get a Publishing stub for the UDDI registry, get an authToken, and perform the save_service call. SaveTModel Demonstrates how to construct and fill the Save_tModel object, get a Publishing stub for the UDDI registry, get an authToken, and perform the save_tModel call. SetAssertions Demonstrates how to construct and fill the Set_publisherAssertions object, get a Publishing stub for the UDDI registry, get an authToken, and perform the set_publisherAssertions call. Prerequisites and Preparatory Steps: Code We expect that you have already installed the Oracle Service 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 neccessary 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 the 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.shrun.bat is located. Local level properties for the BasicInquiry demos are loaded from the file: REGISTRY_HOME\demos\basic\publishing\v3\env.properties Windows: REGISTRY_HOMEdemosbasicpublishingv3env.properties UNIX: Page 664 Prerequisites and Preparatory Steps: Code Table 6. 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\v3\src\demo\uddi\v3\publishing\SaveBusiness.java Windows: REGISTRY_HOMEdemosbasicpublishingv3srcdemouddiv3publishingSaveBusiness.java UNIX: The main method is easy to understand. First it gathers the users input: an optional publisher-assigned businessKey, then variable long array of business entity names with their language codes, and a description of the business. 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. 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. The last step is to discard the authInfo string, so no malicious user can use it to compromise a users account. String businessKey = UserInput.readStringEnter optional businessKey, ; int count = UserInput.readIntEnter count of names, 1; String[] names = new String[count]; String[] languageCodes = new String[count]; for int i = 0; i count; i++ { String tmp = UserInput.readStringEnter language code, ; languageCodes[i] = tmp.length 0 ? tmp : null; names[i] = UserInput.readStringEnter name in language + tmp, 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 665 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 authInfo key. 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 authInfo key, so it cannot be used anymore. public static void discardAuthInfoString authInfo, UDDI_Security_PortType security throws InvalidParameterException, UDDIException { System.out.printLogging out ..; security.discard_authTokennew Discard_authTokenauthInfo; System.out.println done; } 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 businessKey, String[] names, String[] nameLangCodes, String description, String authInfo throws InvalidParameterException { System.out.printlnbusinessKey = + businessKey; for int i = 0; i names.length; i++ { Page 666 Presentation and Functional Presentation System.out.printlnlang = + nameLangCodes[i] + , name = + names[i]; } System.out.printlndescription = + description; BusinessEntity businessEntity = new BusinessEntity; if businessKey=null businessKey.length0 businessEntity.setBusinessKeybusinessKey; for int i = 0; i names.length; i++ { if nameLangCodes[i] == null { businessEntity.addNamenew Namenames[i]; } else { businessEntity.addNamenew Namenames[i], nameLangCodes[i]; } } businessEntity.addDescriptionnew Descriptiondescription; Save_business save = new Save_business; save.addBusinessEntitybusinessEntity; save.setAuthInfoauthInfo; return save; } The UDDI API call save_business is performed in the method saveBusiness: 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++; } } Page 667 Presentation and Functional Presentation Building and Running Demos This section shows how to build and run the Oracle Service Registry Basic Publishing demo set. Lets 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: REGISTRY_HOME\demos\basic\publishing\v3 Windows: REGISTRY_HOMEdemosbasicpublishingv3 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: A 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 the 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: Enter optional businessKey []: uddi:systinet.com:demo:marketing Enter count of names [1]: 1 Enter language code []: Enter name in language [Marketing]: Enter description [Saved by SaveBusiness demo]: Marketing department Using Security at url http:localhost:8888registryuddisecurity .. done Logging in .. done businessKey = uddi:systinet.com:demo:marketing lang = null, name = Marketing description = Marketing department Using Publishing at url http:localhost:8888registryuddipublishing .. done Save in progress ... done Page 668 Building and Running Demos Business 1 : uddi:systinet.com:demo:marketing businessEntity businessKey=uddi:systinet.com:demo:marketing xmlns=urn:uddi-org:api_v3 nameMarketingname descriptionMarketing departmentdescription businessEntity 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.

2. Advanced Demos

Advanced demos section includes the following demos: • Inquiry Range Queries demo - The Oracle Service Registry Range queries demos set demonstrates, how to use Oracle Service Registry inquiry enhancement - Range Queries. Oracle Service Registry range queries functionality allows you to search UDDI entities with the ability to use comparative operators , for matching keyValues in keyedReferences. • Custody demos - The Registry Custody demo covers the custody transfer aspects of the UDDI API specification. You will learn how to generate a custody transfer token and transfer the ownership of selected structures to another user. • Subscription demos - The Registry advanced subscription demos cover the subscription aspects of the UDDI Version 3 Specification. They teach how to use the Registry client API to create new subscriptions, get lists of subscriptions, get subscription results, and delete subscriptions. • Validation demos - The valueset validation API provides methods to validate values used in the keyedReferences of checked taxonomies. The checks might range from very simple check value against list of available values as in the InternalValidation service, to complex, such as performing contextual checks. • Taxonomy demos - The Taxonomy API is used to manage and query taxonomies in the Registry. These demos cover all API methods, so you can learn how to download, upload, save, delete, get and find taxonomies. In addition, you can manage individual values in internally checked taxonomies using the Category API.

2.1. Advanced Inquiry - Range Queries

The Oracle Service Registry Range queries demos set demonstrates, how to use Oracle Service Registry inquiry enhancement - Range Queries. Oracle Service Registry range queries functionality allows you to search UDDI entities with the ability to use comparative operators , for matching keyValues in keyedReferences. The demos set includes the following demo: • FindBusiness

2.1.1. Prerequisites and Preparatory Steps: Code

We expect that you have already installed the Oracle Service Registry and set the REGISTRY_HOME environment variable to the registrys installation location. To run the Oracle Service Registrys demos, your registry must be running. Page 669

2.1.1. Prerequisites and Preparatory Steps: Code

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 env.properties. This file is located in the same directory as the file run.sh run.bat. Local level properties for the Advanced Inquiry demos are loaded from the file: REGISTRY_HOME\demos\advanced\inquiry\env.properties Windows: REGISTRY_HOMEdemosadvancedinquiryenv.properties UNIX: Table 7. Properties Used in Demos Description Default Value Name limit of data returned from registry 5 uddi.demos.result.max_rows the extended inquiry web service port URL http:localhost:8888registryuddiinquiryExt uddi.demos.url.inquiryExt

2.1.2. Presentation and Functional Presentation

This section describes the programming pattern used in demos using the FindBusiness demo as an example. You can find its source code in the file: REGISTRY_HOME\demos\advanced\inquiry\src\demo\uddi\rq\FindBusiness.java Windows: REGISTRY_HOMEdemosadvancedinquirysrcdemouddirqFindBusiness.java UNIX: The helper method createFindBusiness creates a FindBusiness structure: public Find_business createFindBusinessString tModelKey, String keyValue, String operator, String quantifier throws InvalidParameterException { System.out.printlntModelKey = + tModelKey; System.out.printlnkeyValue = + keyValue; System.out.printlnoperator = + operator; System.out.printlnquantifier = + quantifier; Find_business find_business = new Find_business; QualifiedKeyedReference qualifiedKeyedReference = new QualifiedKeyedReference; qualifiedKeyedReference.setTModelKeytModelKey; qualifiedKeyedReference.setKeyValuekeyValue; qualifiedKeyedReference.setFindQualifierArrayListparseFindQualifiersoperator, quantifier; find_business.setCategoryBagnew CategoryBagnew KeyedReferenceArrayListqualifiedKeyedReference; find_business.setMaxRowsnew IntegerMAX_ROWS; Page 670

2.1.2. Presentation and Functional Presentation