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, Pages, and Books

This chapter focuses on how to use Workshop for WebLogic to create and configure remote portlets, pages, and books. 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, pages, and books. 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 an Oracle WebLogic Server v10.x.
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 Project Explorer after the prerequisite tasks have been completed.

Figure 4-2 Project Explorer After Prerequisite Tasks are Completed

Project 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 Project 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 a WSDL URL. For example:
  8. http://wsrp.bea.com/portal/producer?wsdl

    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: If the producer was previously added to the consumer, it will appear in the Select Producer list, and you can simply choose Select Producer and select the producer from the list.
    Tip: 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. This dialog also lets you choose to store registration properties on the consumer and (if available) edit the registration properties Registration properties are values that are passed from the consumer to the producer when the producer is registered. These values can be used to allow producers to control which portlets are offered to specific consumers. For detailed information storing registration properties, see Other Topics and Best Practices.
  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. Note: If the producer does not require registration, the Producer’s Handle field will appear editable and initialized. In this case, you must enter an arbitrary value for the producer handle before the Create button will be enabled.
    Figure 4-9 The Proxy Portlet Details


    The Proxy Portlet Details

  22. Click Create.

The new remote portlet shows up in the Project 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 Project 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 Project 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 Oracle WebLogic Server v10.x 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:

 


Creating Remote Pages and Books

The primary advantage of remote books and pages is that they act as containers for other remote resources. For example, a producer can offer a remote book that contains several remoteable pages, each of which contain multiple remoteable portlets. When you consume that book, the remoteable pages and portlets it contains are consumed as well—no additional steps are required.

Tip: The term remoteable refers to a book, page, or portlet that is deployed in a producer application and that is offered as remote to consumers. Application developers decide whether or not books, pages, and portlets they create are offered as remote.

For detailed information on creating remoteable pages and books in a producer application, see Offering Books, Pages, and Portlets to Consumers. If a remote book or page does not appear as you expect it to, see Rules for Creating Remoteable Books and Pages.

Remember that changes you make to a remote book or page are not reflected back to the producer; therefore, after a remote book or page is modified on the consumer, it can become inconsistent with the original book, page, or portlet in the producer application.

You can add remote books and pages to your portal as you would any other book or page.

Basic Procedure

The procedure for creating a remote page or book is similar to the procedure for creating a remote portlet.

Tip: This example explains how to create a remote page. The procedure for creating a remote book is similar.
  1. Select File > New > Other.
  2. In the New dialog, select Remote Page (or Remote Book), as shown in Figure 4-13, and click Next.
  3. Figure 4-13 Creating a New Remote Page


    Creating a New Remote Page

  4. In the New Remote Page dialog, select a folder in which to place the resulting .page file, and give the file a name, as shown in Figure 4-14, and click Next.
  5. Figure 4-14 Creating a Remote Page File


    Creating a Remote Page File

  6. In the Page Producer dialog, select Find Producer and, in the field provided, enter the WSDL URL of the producer, as shown in Figure 4-15:
  7. The pattern for the WSDL URL is as follows:

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

    where 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 remoteable pages and books are deployed.

    Tip: If the producer was previously added to the consumer, it will appear in the Select Producer list, and you can simply choose Select Producer and select the producer from the list.
  8. After entering the WSDL URL, click Retrieve.
  9. Checkpoint: At this point, the consumer uses the WSDL URL to locate the producer and learn about its available remoteable pages. The Producer Details section of the wizard panel now displays information about the producer, including the number of pages that are available to the consumer, as shown in Figure 4-15.

  10. Click Register in the Producer Details section of the wizard panel, as shown in Figure 4-15. The Register dialog appears.
  11. Figure 4-15 Producer Details


    Producer Details

    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 books and pages offered by the producer. See Complex Producers for more information.
  12. In the Register dialog, enter a handle name in the Producer Handle field, as shown in Figure 4-6. This handle identifies the producer on the consumer.
  13. Figure 4-16 Registering the Producer


    Registering the Producer

  14. Click Register. You are returned to the New Remote Page– Page Producer dialog.
  15. Checkpoint: At this point the WSDL data from the producer has been retrieved and is displayed in the Producer Details panel of the dialog.

  16. Click Next to proceed.
  17. In the Select Page from List dialog, select one of the remote pages from the list of pages offered by the producer, as shown in Figure 4-8, and click Next.
  18. Figure 4-17 Select a Page on the Producer


    Select a Page on the Producer

  19. The Remote Page Details dialog appears. The title of the page you selected appears in the Page Title field, as shown in Figure 4-9. You can change this title if you want to.
  20. Note: If the producer does not require registration, the Producer’s Handle field will appear editable and unitialized. In this case, you must enter an arbitrary value for the producer handle before the Finish button will be enabled.
    Figure 4-18 The Remote Page Details Dialog


    The Remote Page Details Dialog

  21. Click Finish.

The new remote page shows up in the Project Explorer in the folder you selected. The page appears as a .page file, for example, /WebContent/myRemotePage.page. You can now add the remote page to your portal. Any remoteable portlets on the page will show up in the remote page as inlined portlets. For more information on remoteable portlets, pages, and books as remote, see Offering Books, Pages, and Portlets to Consumers. For information on inlined portlets, see the Portlet Development Guide.


  Back to Top       Previous  Next