Federated Portals Guide

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Publishing to UDDI Registries

WebLogic Portal provides tools for searching UDDI registries for producers, portlets, books, and pages. In addition, WebLogic Portal allows you to publish portlets, books, and pages to UDDI registries.

This chapter explains how to publish portlets, books, and pages, and the producers in which they are deployed, to UDDI registries. This chapter also discusses an API for performing UDDI searches programatically.

Tip: The WebLogic Portal Administration Console provides search tools that let you search UDDI registries for producers and portlets. Before you can use the search features in the Administration Console, however, you must set up the consumer as explained in this chapter.

This chapter includes the following sections:

 


What is UDDI?

Universal Description, Discovery, and Integration (UDDI) is a standard mechanism for describing and locating web services across the internet. Web services, such as WSRP producers, are typically published to a UDDI registry with associated metadata. Users can search UDDI registries using keywords to locate producers and the portlets and other services they offer.

Tip: Before the availability of the UDDI registry, a WebLogic Portal developer or administrator needed to know the WSDL URL address of a specific producer to discover that producer’s portlets. Now, developers and administrators can search for specific producers and their resources based on metadata queries; to locate a producer, you do not necessarily need to know its WSDL URL in advance.

As Figure 9-1 illustrates, metadata from producers, including metadata for portlets, books, and pages, is published to a UDDI registry. Using keywords, consumers can search UDDI registries to locate these services and consume them.

Figure 9-1 Overview of UDDI Publishing and Searching

Overview of UDDI Publishing and Searching

Tip: OASIS, the Organization for the Advancement of Structured Information Standards, is responsible for creating the UDDI standard. To read more about UDDI, including the full technical specification, go to:

http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=uddi-spec

 


Using UDDI with WebLogic Portal

If you want to publish a producer and its resources to a UDDI registry, you need to configure the producer. Similarly, if you want to be able to search UDDI registries from a WebLogic Portal consumer application, you need to configure the consumer so that it can locate and use the UDDI registries.

This section summarizes the main tasks you need to perform to use UDDI registries with WebLogic Portal:

Configure the Producer

WebLogic Portal applications are not automatically published to UDDI registries. You need to configure the application to publish its resources. The section Configuring the Producer explains how to configure a producer so that the producer and its resources (books, pages, and portlets) appear in one or more UDDI registries.

Configure the Consumer

When a consumer is properly configured, you can search UDDI registries for producers and their resources both programmatically and interactively using the WebLogic Portal Administration Console. The section Configuring the Consumer explains how to configure a consumer so that it can locate and search specific UDDI registries.

Perform Searches

If you are interested in performing programmatic UDDI registry searches from a consumer, see Searching for Producers Programatically. If you are interested in the tools provided for searching UDDI registries in the Administration Console, see Adding Remote Resources to the Library.

 


Configuring the Producer

This section explains how to publish producers and their resources, such as portlets, pages, and books, to a UDDI registry. To do this, you need to configure the producer properly.

This section includes the following topics:

What Information is Published?

All portlets, books, and pages with the offerRemote property set to true are automatically published in the properly configured UDDI registry or registries. For information on setting the offerRemote property, see Enabling and Disabling UDDI for a Producer.

Note: It is possible that empty books and pages will be published to the registry. The books and pages are resolved on a service description request and empty books/pages are excluded. Because the registry directly polls the book and page repository and the repository may contain empty pages/books, the registry might publish empty pages and books.
Note: Publishing occurs asynchronously, and it may take from a few seconds to several minutes to publish all portlets, pages and books in a producer to the registry. Children of pages and books are not published automatically to the registry.

Table 9-1 lists the specific types of information that are published to the UDDI registry for each published component.

Table 9-1 Information Published to UDDI Registries
Elements
Attributes
Producers
  • Name (required)
  • Description
  • Keywords
  • WSDL URL of the producer. The developer or administrator who configures the producer must enter this URL. This URL is the WSDL URL that the consumer uses to access the producer.
Portlets (from .portlet files)
  • Title (required)
  • Description
  • portletHandle (definition label) as the access URI. This is a unique value assigned to the portlet by the producer.
Pages (from .page files)
  • Title (required)
  • pageHandle (definition label) as the access URI. This is a unique value assigned to the page by the producer.
Books (from .book files)
  • Title (required)
  • bookHandle (definition label) as the access URI. This is a unique value assigned to the book by the producer.
Common data
  • Words from the title of portlets, books and pages, and the description of portlets, are used as keywords
  • Additional keywords added with netuix:meta tags. These tags can be embedded in .portal, .book, and .portlet files.
  • A reference to the producer’s business service

Editing the Configuration File

The first step in publishing a producer and its resources is to edit the configuration file wsrp-producer-portlet-registry-config.xml. To edit the file, you must first copy it to your web project. To do this, select the Merged Projects view, navigate to the WEB-INF folder of the producer web application, right-click wsrp-producer-portlet-registry-config.xml, and select Copy To Project. This makes the file available for editing in your project’s WEB-INF folder.

This file is used to publish a producer and its resources, such as portlets, to specified UDDI registries. An example configuration file is shown in Listing 9-1. Each of the configuration file’s elements are listed and defined in Table 9-2. When editing the configuration file, be sure to complete all of the required elements, as listed in the table.

Note: By default, the <enabled> element of this file is set to false. When you set this element to true, the producer and all of its books, pages, and portlets are published to the specified UDDI registries. If you do not want to publish a specific book, page, or portlet, you must set its offerRemote property to false.
Listing 9-1 Example wsrp-producer-portlet-registry-config.xml File
<?xml version="1.0" encoding="UTF-8"?>
<wsrp-producer-portlet-registry-config xmlns="http://www.bea.com/ns/portal/90/wsrp-producer-portlet-registry-config">

<description>Description goes here</description>

<!-- Set this to false to prevent this producer from publishing portlets. -->
<enabled>true</enabled>

<publish-url>http://localhost:7001/uddi/uddilistener</publish-url>
<inquiry-url>http://localhost:7001/uddi/uddilistener</inquiry-url>

<!--credential-alias>registryPublisherComplexProducer</credential-alias-->
<username>weblogic</username>
<password>weblogic</password>

<producer-business-entity>
<name>Sample Producer</name>
<description>This is a producer business entity</description>
<discovery-url>http://localhost:7001/portal_2/index.jsp</discovery-url>
</producer-business-entity>

<producer-service>
<name>Sample Producer</name>
<description>This producer hosts test portlets for portal_2</description>
<wsdl-url>http://localhost:7001/portal_2/producer?WSDL</wsdl-url>
<keyword>skiing</keyword>
<keyword>hiking</keyword>
<keyword>camping</keyword>
<keyword>cycling</keyword>
</producer-service>
</wsrp-producer-portlet-registry-config>

Table 9-2 describes the configuration file’s elements.

Table 9-2 Elements in the wsrp-producer-portlet-registry-config.xml File  
Element
Description
<enabled>
Set this element to true to publish the producer’s portlets, books, and pages to the UDDI registry specified by the <publish-url> element. This element is set to false by default.
<description>
You can put any arbitrary text in a description element. This element is typically used to embed comments in the file.
<publish-url>
<inquiry-url>
(required) UDDI registries typically have two URLs associated with them. The publish URL allows creation and update of elements. The inquiry URL allows searches, but does not allow updating or creating.
<credential-alias>
or
<username>
<password>
(required) To publish producer information to a UDDI registry, you must have the necessary credentials. There are two ways to specify these credentials:
  • Specify a credential alias using the <credential-alias> element. Credential aliases are defined in the Administration Portal. For detailed information on defining a credential alias, see Specifying Access Credentials.
  • Specify a user name and password directly. This second method is not recommended, because it requires a clear text password.
<producer-business-entity>
(required) A business entity is the highest level UDDI data construct. This element specifies the owner of the published web services. Typically, the name of a company or department is specified.
The <producer-business-entity> element includes the following elements:
  • <name> (required) — A unique name for the service.
  • <description> — A description of the service. Required if the business entity is auto-configured.
  • <discovery-url> — Provides a discovery URL for the producer. The URL specified here must be a valid URL, and not a URL template. Required if the business entity is auto-configured.
<producer-service>
(required) The <producer-service> element defines a business service. A business service is a UDDI data construct that specifies entities that offer services, such as WSRP producers. Business services are owned by business entities.
The <producer-service> entity includes the following elements:
  • <name> (required) — A unique name for the service.
  • <description> — A description of the service.
  • <wsdl-url> (required) — A publicly available WSDL URL for the producer.
  • <keyword> (optional, recommended) — Keywords are used by UDDI queries to locate producers. You can define as many keywords as you like.

Configuring Third-Party Registries

To configure a WebLogic Portal application to use a third-party UDDI registry, you need to:

Specifying Access Credentials

Some registries may offer both publish and inquiry services at the same URL, while some others use separate URLs for these two services. Consult the specific registry documentation to find out the actual URLs.

Depending on how the registry enforces access control, you may also need to enter either a set of credentials or an alias to a credential. The credentials must allow sufficient permission to access all UDDI publish operations. Again, consult the registry's documentation to find out the access control policies.

You can set access credentials in the wsrp-producer-portlet-registry-config.xml or using the WebLogic Portal Administration Console.

For information on the configuration file, see Configuring the Producer. For information on setting credentials through the Administration Console, see Modifying the Producer Portlet Registry.

Creating tModels for Third-Party Registries

Services stored in UDDI registries are categorized and identified by their taxonomies. Basically, a taxonomy, also called a tModel, is a name/key mapping.

For the purpose of publishing them to UDDI registries, producers, portlets, books, and pages all have taxonomies, which are defined in XML files. Default taxonomies are provided to describe producers, portlets, books, and pages for WebLogic Server’s internal UDDI registry. If you want to use a third party registry, log in to that registry and create a tModel for each taxonomy found in the internal WebLogic UDDI registry. Consult the documentation provided for the third-party registry for information on how to create taxonomies for that particular registry.

The internal WebLogic UDDI tModel files are located in:

<WLP_HOME>/lib/wsrp/tModels

where <WLP_HOME> is the root directory for your WebLogic Portal installation.

Tip: A tModel is a data structure representing a service type (a generic representation of a registered service) in the UDDI registry. Each business registered with UDDI categorizes all of its Web services according to a defined list of service types. Businesses can search the registry's listed service types to find service providers. The tModel is an abstraction for a technical specification of a service type; it organizes the service type's information and makes it accessible in the registry database. Another UDDI data structure, the bindingTemplate organizes information for specific instances of service types. When businesses want to make their specification-compliant services available to the registry, they include a reference to the tModelKey for that service type in their bindingTemplate data.

Each tModel consists of a name, an explanatory description, and a Universal Unique Identifier (UUID). The tModel name identifies the service, such as, for example, online order placement. The description supplies additional arbitrary information about the service. The unique identifier, called a tModelKey, is a series of alphanumeric characters, such as uuid:4CD7E4BC-648B-426D-9936-443EAAC8AI.

Pre-Configuring the Business Entity

If you pre-configure a business entity directly in the UDDI registry, you can then associate that entity with a producer using only the name of the business entity. For example, Listing 9-2 shows a <producer-business-entity> element that identifies a pre-configured business entity. In this case, the entity with the name “My Portlet Producer” was pre-configured in the UDDI registry. In this example, the <description> and <discovery-url> elements are not necessary.

For information on configuring <producer-business-entity> and <producer-service> entities for a given UDDI registry, consult the documentation for that registry. Typically, you can also use the JAXR API to programmatically create business entities.

Listing 9-2 Business Entity Description for a Pre-Configured Producer
<producer-business-entity>
    <name>My Portlet Producer</name>
</producer-business-entity>

If you pre-configure a business entity, WebLogic Portal requires only the name of the business entity to use it (as shown in Listing 9-2). Multiple producer web applications can use the same business entity by using this same name. If you want different producer web applications to use their own unique business entity, use unique names for your business entities.

Auto-Configuring the Business Entity

WebLogic Portal can automatically create a business entity if you supply the <discovery-url> element in the wsrp-producer-portlet-registry-config.xml file. For example, the wsrp-producer-portlet-registry-config.xml file configuration shown in Listing 9-3 allows the business entity to be created automatically.

Listing 9-3 Business Entity Description for an Auto-Configured Producer
<producer-business-entity>
    <name>My Portlet Producer</name>
    <description>This is my business entity</description>
    <discovery-url>http://somehost:port/path</discovery-url>
</producer-business-entity>

When you deploy the web application, the producer first checks the registry to see if a business entity with the specified name exists. If not, WebLogic Portal creates a new business entity with the given <name>, <description>, and <discover-url>.

Specifying Metadata for Searches

By adding metadata, such as keywords, to producers, portlets, pages and books, you will improve the ability of consumers to find those resources in a search. This section discusses how to add searchable metadata for portlets, books, and pages. For information on adding publishing producer metadata, see Adding Producer Metadata.

Adding Producer Metadata

UDDI searches can locate producers using metadata that has been added to the wsrp-producer-portlet-registry-config.xml file described previously. Both the <name> and <description> elements of the <producer-service> element are searchable. In addition, you can use the <keyword> element of the <producer-service> element to add metadata, as shown in Listing 9-4.

Listing 9-4 Specifying Producer Metadata Keywords
<producer-service>
     <name>Colorado Producer</name>
     <description>
          This producer offers portlets related to Colorado.
     </description>
     <wsdl-url>http://colorado/producer?wsdl</wsdl-url>
     <keyword>skiing</keyword>
     <keyword>hiking</keyword>
     <keyword>camping</keyword>
</producer-service>

Adding Portlet Metadata

UDDI searches can locate portlets by their title and description. When you create a portlet, you are required to give it a title, and, optionally, you can enter a description. The text of these two fields is available to UDDI searches. In addition to these tags, you can use the <netuix:meta> tag to provide searchable metadata. To do this, add a meta tag and specify name and content attributes. Listing 9-5 shows a sample portlet file with a meta tag that specifies a named item (activities) with several content attirubtes (hiking, camping, fishing). The separator attribute simply specifies a character to separate multiple content values.

Listing 9-5 Portlet with Metadata Tags

<?xml version="1.0" encoding="UTF-8"?>
<portal:root
xmlns:netuix="http://www.bea.com/servers/netuix/xsd/controls/netuix/1.0.0"
xmlns:portal="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/servers/netuix/xsd/portal/support/
1.0.0 portal-support-1_0_0.xsd">
<netuix:portlet definitionLabel="index_1" title="Activities">
    <netuix:meta name="activities" content="hiking;camping;fishing"         separator=";"/>
<netuix:titlebar>
    <netuix:maximize/>
            <netuix:minimize/>
        </netuix:titlebar>
<netuix:content>
<netuix:jspContent contentUri="/activities.jsp"/>
</netuix:content>
</netuix:portlet>
</portal:root>

Adding Book and Page Metadata

UDDI searches can locate specific books and pages by their title. When you create a book or page, you are required to give it a title. This title is available to UDDI searches. Just as with portlets, you can embed the <netuix:meta> tag in .book and .page files to add searchable metadata keywords. See Listing 9-5 for an example.

Note: Only remoteable .book and .page files can be published to UDDI registries. See Offering Books, Pages, and Portlets to Consumers for more information on creating remoteable books and pages.

By default, the <enabled> element of this file is set to false. You must set it to true to publish the producer.

Enabling and Disabling UDDI for a Producer

You can enable or disable UDDI searching for an entire producer web application or for specific portlets, books, and pages.

Enabling and Disabling a Producer Web Application for UDDI Searches

You can disable UDDI publishing for an entire web application by setting the <enabled> element in the wsrp-producer-portlet-registry-config.xml file to false. If this element is false, then none of the portlets, pages, or books in the web application will be accessible to UDDI queries. If the element is true, then all portlets, pages, and books in the web application are published, unless individually disabled using with the offerRemote property.

The wsrp-producer-portlet-registry-config.xml file is located in the /WEB-INF directory of each web application in a producer. (To edit this file, you must first copy it from the J2EE Shared Library in which it is stored into your project.)

Enabling and Disabling Individual Producer Resources for UDDI Searches

The offerRemote property can be set to true or false for any portal resource (portlets, pages, and books) that can be remote. If true, then the resource is offered as remote, and it can be discovered and consumed remotely by a consumer. If false, then the resource is hidden from view from consumers. You can set this property from the Properties view for a portlet, book, or page, as shown in Figure 9-2.

Figure 9-2 Setting the offerRemote Property

Setting the offerRemote Property

Note: Changing the offerRemote value in no way affects the contents of the registry. If the offerRemote property is changed to false after the entity has been published, the producer will not delete the entity from the registry. For example, a portlet may exist in the registry if it was published, but be unavailable to WebLogic Portal consumers if offerRemote is set to false.

 


Configuring the Consumer

In order to use the search tools, either through the API or the WebLogic Portal Administration Console, you must set up the wsrp-consumer-portlet-registry-config.xml for the consumer. This file defines the UDDI registry information, such as UDDI inquiry URL, number of rows to return, and description. A consumer may need to search more than one registry and all registries must be defined in this file.

Note: The wsrp-consumer-portlet-registry-config.xml file is located in the META-INF directory of the enterprise application. By default, this file is empty. You must configure this file, as described in this section, or administrators and users will not be able to use the UDDI search feature. (To edit this file, you must first copy it from the J2EE Shared Library in which it is stored into your project.)

Listing 9-6 shows an example configuration file. After you configure the consumer, you must restart the application.

Listing 9-6 wsrp-consumer-portlet-registry-config.xml File
<wsrp-consumer-portlet-registry-config
xmlns="http://www.bea.com/ns/portal/90/wsrp-consumer-portlet-registry-config">
<description>WLP Tools WSRP Registry Configuration</description>
<registry>
<name>defaultRegistry</name>
<title>Default Registry</title>
<description>This is the default registry.</description>
<default>true</default>
<inquiry-url>http://localhost:7001/uddi/uddilistener</inquiry-url>
<max-results>500</max-results>
</registry>
<registry>
<name>SecondRegistry</name>
<title>Second Registry</title>
<description>Another registry.</description>
<default>false</default>
<inquiry-url>http://localhost:8080/uddi/inquiry</inquiry-url>
<max-results>500</max-results>
</registry>
</wsrp-consumer-portlet-registry-config>

 


Searching for Producers Programatically

WebLogic Portal provides two ways to search for producers. If you are working in the staging or production environments, you can use the WebLogic Portal Administration Console to search for producers. WebLogic Portal also exposes an API that lets you search programmatically. You might use the API if you wanted to write your own search tool.

Note: Empty books and pages do not show up in UDDI searches.

For information on searching for producers in the Administration Console, see Adding Remote Resources to the Library.

The rest of this section discusses how to use the API to search for producers. This section includes the following parts:

The UDDI Query API

WebLogic Portal provides an API that you can use to search UDDI registries for producers, portlets, pages, and books. Typically, this API is used for the development of custom search tools.

The following packages contain the API that you can use to search UDDI registries for producers, portlets, pages, and books:

The following tables summarize the classes in these three packages. Please refer to the Javadoc for detailed information on these classes.

Table 9-3 com.bea.wsrp.registry.entries Package
Class or Interface
Purpose
BaseEntry
Represents a producer, portlet, page, or book in the UDDI registry.
RegistryEntry
Represents a base class for producer-offered entities (portlets, pages, and books).
ProducerEntry
Represents a producer entry. This class contains the producer’s metadata including its WSDL URL.
PortletEntry
Represents a portlet entry in the UDDI registry.
PageEntry
Represents a page entry in the UDDI registry.
BookEntry
Represents a book entry in the UDDI registry.

Table 9-4 com.bea.wsrp.registry Package
Class or Interface
Purpose
ConnectInfo
Contains connection information for a UDDI registry, such as the inquiry URL and an optional set of properties.
RegistryConfig
Represents a UDDI registry’s configuration information, such as the registry name and inquiry URL.

Table 9-5 com.bea.wsrp.registry.find Package
Class or Interface
Purpose
FindRequest
Specifies search criteria.
RegistryFinder
Finds producers, portlets, pages, and books. Also provides methods to get details of pre-configured registries.

Sample Code

The code fragment in Listing 9-7 shows how the API can be used to search for and discover portlets and producers in a UDDI registry.

Listing 9-7 UDDI Search Code Fragment
import com.bea.wsrp.registry.entries.*;
import com.bea.wsrp.registry.*;
import com.bea.wsrp.registry.find.*;

public class UDDIQuery {

    
    public void doQuery() {
    
        ConnectInfo ci = RegistryFinder.getDefault();
        FindRequest fr = new FindRequest();
        fr.addName("Hello");
        fr.addKeyword("hello");
        fr.addKeyword("world");
    
        List<PortletEntry> portlets = registryFinder.findPortlets(fr, connectInfo);

        //-- User selects a portlet from the list.

        Key producerKey = portletEntry.getProducerKey();
        fr = new FindRequest();
        fr.setProducerServiceKey(producerKey);
        List<ProducerEntry> producers = registryFinder.findProducers(fr, connectInfo);

        //-- User selects a producer from the list.
    
        }
    }


  Back to Top       Previous  Next