Federated Portals Guide

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

Creating Remote Portlets

This chapter focuses on how to use Workshop for WebLogic to create and configure remote portlets. This chapter includes the following sections:

 


Introduction

Before getting started, we recommend that you review the following chapters in the architecture part of this guide:

.These chapters explain basic concepts such as producers, consumers, and remote portlets. This chapter assumes you familiar with these concepts.

Note: This chapter is primarily for developers using Workshop for WebLogic to create consumer portal applications. If you plan to use the WebLogic Portal Administration Console to create federated portals, see Part III, Staging.

 


What Types of Portlets Can Be Remote?

WebLogic Portal applications can consume the following types of portlets:

To be consumable, a portlet must be deployed to a web application that is running in a WSRP-compliant producer. The consumer application must also be capable of contacting the producer using the producer’s WSDL URL.

 


Creating a Remote Portlet

This section presents a step-by-step example showing you how to create a remote (proxy) portlet in a consumer application using Workshop for WebLogic. This section includes the following topics:

Overview

For this example, you will consume a portlet deployed in a producer application. The producer application in this example is a Portal Web application deployed to a WebLogic Portal Domain.

Tip: For information on working with a producer that is running in a WebLogic Server domain (as opposed to a WebLogic Portal Domain), see Configuring a WebLogic Server Producer.

The basic procedure for creating remote portlets is fairly simple: Workshop for WebLogic provides a convenient wizard for this purpose. No programming is required. The basic steps always include:

  1. Locating a producer.
  2. Selecting a remote portlet on the producer.
  3. Consuming the portlet.

Figure 4-1 illustrates the basic parts of a federated portal, where the consumer includes a remote portlet. A remote portlet is a proxy for a portlet that is deployed in a producer application.

Tip: To an end user, the features of the remote portlet are indistinguishable from the actual portlet deployed on the producer. It is possible, however, to customize many of the properties of a proxy portlet, as explained in Configuring Remote Portlets.
Figure 4-1 Remote Portlet in a Consumer

Remote Portlet in a Consumer

Setting Up the Example

If you want to try the example discussed in this section, you need to run Workshop for WebLogic and perform the prerequisite tasks outlined in this section.

To set up the example environment, perform the prerequisite tasks outlined in Table 4-1. If you are not familiar with the specific procedures for these tasks, they are described in detail in the tutorial Setting Up Your Portal Development Environment.

Table 4-1 Prerequisite Tasks
Task
Recommended Name
Create a WebLogic Portal domain.
consumerPortalDomain
Create a Portal EAR Project.
portalEarProject
Create a BEA WebLogic V9.2 Server.
N/A
Associate the EAR project with the server.
N/A
Create a Portal Web Project and add it to the EAR.
consumerProject
Create a portal.
consumer.portal

Figure 4-2 shows the Package Explorer after the prerequisite tasks have been completed.

Figure 4-2 Package Explorer After Prerequisite Tasks are Completed

Package Explorer After Prerequisite Tasks are Completed

Locating and Consuming a Portlet

  1. Be sure you have set up the example environment as explained previously in Setting Up the Example.
  2. Open the consumerProject folder in the Package Explorer, right-click on the WebContent folder, and select New > Portlet.
  3. Tip: If you do not see the Portlet feature on the New menu, be sure to open the Portal perspective using Window > Open Perspective > Portal.
  4. In the New Portlet dialog, enter remoteExample.portlet in the File name field, and click Finish. The Select Portlet Type dialog appears.
  5. In the Select Portlet Type dialog, select Remote Portlet, as shown in Figure 4-3, and click Next. The Portlet Wizard – Producer dialog box appears.
  6. Figure 4-3 Select Portlet Type Dialog


    Select Portlet Type Dialog

  7. In the Portlet Wizard – Producer dialog, select Find Producer and, in the field provided, enter the following WSDL URL, as shown in Figure 4-4:
  8. http://wsrp.bea.com/portal/producer?wsdl

    You can use another WSDL URL if you want to. Just remember that the pattern for the URL is as follows:

    http://host:port/webAppName/producer?wsdl

    where host is the host and port are the hostname and port number of the server on which the producer is deployed, and webAppName is the name of the web application in which the producer’s portlets are deployed.

    Tip: This WSDL URL points to an example producer hosted by BEA. This example producer hosts several demonstration portlets. WSDL stands for Web Services Description Language and is used to describe the services offered by a producer. For more information, see Federated Portal Architecture.
    Figure 4-4 Entering the WSDL


    Entering the WSDL

  9. After entering the WSDL URL, click Retrieve.
  10. Checkpoint: At this point, the consumer uses the WSDL to locate the producer and learn about its available portlets. The Producer Details section of the wizard panel now displays information about the producer, including the number of portlets that are available to the consumer, as shown in Figure 4-5.

  11. Click Register in the Producer Details section of the wizard panel, as shown in Figure 4-5. The Register dialog appears.
  12. Tip: During registration, the producer stores information about the consumer and returns a handle to the consumer. Registration is an optional feature described in the WSRP specification. A WebLogic Portal complex producer implements this option and, therefore, requires consumers to register before discovering and interacting with portlets offered by the producer. See Complex Producers for more information.
    Figure 4-5 Producer Details


    Producer Details

  13. In the Register dialog, enter beaProducer in the Producer Handle field, as shown in Figure 4-6. This handle identifies the producer on the consumer.
  14. Figure 4-6 Registering the Producer


    Registering the Producer

  15. Click Register. You are returned to the Producer dialog.
  16. Checkpoint: At this point the WSDL data from the producer has been retrieved and is displayed in the Producer Details panel of the dialog, as shown in Figure 4-7. Note that four portlets on the producer are available to the consumer.

    Figure 4-7 Registration Information


    Registration Information

  17. Click Next to proceed.
  18. In the Select Portlet from List dialog, select one of the remote portlets from the list of portlets on the producer, as shown in Figure 4-8. You can pick any one of them.
  19. Figure 4-8 Select a Portlet on the Producer


    Select a Portlet on the Producer

  20. Click Next. The Proxy Portlet Details dialog appears. The title of the portlet you selected appears in the Portlet Title field, as shown in Figure 4-9. You can change this title if you want to.
  21. Figure 4-9 The Proxy Portlet Details


    The Proxy Portlet Details

  22. Click Create.

The new remote portlet shows up in the Package Explorer in the WebContent folder, as shown in Figure 4-10.

Figure 4-10 Remote Portlet

Remote Portlet

Viewing the Portlet

To view the portlet, you need to add it to the consumer portal, as explained in this section.

  1. If it is not already open, open the consumerProject/WebContent folder.
  2. Double-click the file consumerPortal.portal in WebContent folder. The portal editor appears in Workshop for WebLogic.
  3. Drag the remoteExample.portlet file from the Package Explorer to the portal. The result is shown in Figure 4-11.
  4. Figure 4-11 Remote Portlet Placed in Portal


    Remote Portlet Placed in Portal

  5. To test the portal, right-click the portal filename, remoteExample.portlet, in the Package Explorer, and select Run As > Run On Server. The New Server – Define a Server dialog appears.
  6. In the Run On Server – Define a New Server dialog, be sure the BEA WebLogic v9.2 Server is selected, and click Finish.
  7. The portal containing the remote portlet appears in a browser, as shown in Figure 4-12.
  8. Figure 4-12 Federated Portal


    Federated Portal

Summary

In this section you added a remote portlet to a WebLogic Portal consumer application. The consumed portlet is a proxy for a portlet that is deployed in a remote producer application. In addition to the basic setup steps, this example demonstrated the following tasks:


  Back to Top       Previous  Next