![]() ![]() ![]() ![]() ![]() ![]() |
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:
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.
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 |
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:
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.
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.
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.
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:
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.
The first step in publishing a producer and its resources is to edit the configuration file wsrp-producer-portlet-registry-config.xml
. When copied to your project from the J2EE Shared Library in which it is stored, this file is located in the /WEB-INF
directory of each web application in a producer. 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. |
<?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.
Note: | The registry credential alias set in wsrp-producer-portlet-registry-config.xml file must not match the global credential in wsrp-consumer-security-config.xml . Setting the global credential is explained in Modifying Global Credentials. |
(required) To publish producer information to a UDDI registry, you must have the necessary credentials. There are two ways to specify these credentials:
|
|
(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.
See Pre-Configuring the Business Entity and Auto-Configuring the Business Entity for more information.
|
|
(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.
|
To configure a WebLogic Portal application to use a third-party UDDI registry, you need to:
<publish-url>
and <query-url>
addresses and add them to the wsrp-producer-portlet-registry-config.xml
configuration file. For information on this configuration file, see Editing the Configuration File. 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.
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:
WEBLOGIC_HOME
/portal/lib/wsrp/tModels
where WEBLOGIC_HOME
is the root directory for your WebLogic 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 . |
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.
<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.
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.
<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>
.
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.
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.
<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>
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.
<?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>
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.
You can enable or disable UDDI searching for an entire producer web application or for specific portlets, books, and pages.
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.)
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.
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 . |
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.
<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>
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:
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:
com.bea.wsrp.registry
This package contains classes let you get and set configuration information for a UDDI registry. The classes in this package are described in Table 9-3.
com.bea.wsrp.registry.entries
This package contains classes that represent registry entries, such as producers, portlets, books, and pages. Methods in these classes let you get and set keywords, titles, descriptions, and other data elements for these entries. The classes in this package are described in Table 9-4.
com.bea.wsrp.registry.find
This package contains classes that let you construct and execute UDDI registry queries. The classes in this package are described in Table 9-5.
The following tables summarize the classes in these three packages. Please refer to the Javadoc for detailed information on these classes.
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.
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.
}
}
![]() ![]() ![]() |