# Buildng a Remote Portlet

Remote, or "proxy," portlets present content collected from WSRP-compliant producers. Remote portlets route requests from users to the appropriate Producers which, in turn process the request and send results back to the consumer. Consumers then aggregate the results coming from various producers and send the final result back to the user, who can view and use those results in remote portlets. Consumers have the ability to keep traffic separated and maintain all interactions private to that specific user during the interaction.

This procedure describes how to:

- Create a remote portlet for either a complex or simple producer.
- Add that portlet to a portal.
- View the portal and the new remote portlet.

## Before You Begin

Before you begin this procedure, you must have already created a domain, a portal application, and a portal project. If you haven't, please do so by using the procedures outlined in:

- Creating and Configuring Domains Using the Configuration Wizard (link)
- Creating a Portal Application and Portal Web Project

## Creating the Portlet

To create a remote portlet, use this procedure:

1. With WebLogic Workshop running, right-click the application that hosts the portal for which you are creating the portlet and right-click the portal application (alternately, select tha application and select File>New>Portlet).
2. Select New > Portlet.

> > (Alternately, open the File menu and select New > Portlet)

> > The New File window appears.

2. On New File, do the following:
   1. In File name, replace "Untitled" with the name of the portlet (do not change the file extension, .portlet).

   2. If the portal project displayed in Create in: is not the project inwhich you want to create the portlet, click Browse to display the Select dialog box and select the desired project (optional)
   3. Click Create.

      The Portlet Wizard appears.

3. Under Select Portlet Type, select Remote Portlet and click Next.

   The Portlet Wizard's Find Producer window of the appears:

   On this window, you can either specify the WSDL for the producer you want to use or select one from the drop-down list.

4. Do one of the following:

- Type the WSDL of the producer of the remote portlet you want to use and click Retrieve; for example:

  OR

- Click Select Producer, open the drop-down list of producers handles, and select a producer from that list.

  The Find Producer window refreshes, this time displaying details on the producer you selected:

  If Requires Registration is true and you are not registered with the producer (indicated by Registration handle : Not Registered), click Register do the following:

  NOTE: If registration is not required (Requires Registration: False) proceed to step 4.

  1. Click Register.

     The Register window appears:

1. In Producer Handle, type a name with which you want to identify the producer (on subsequent uses, this name will appear in the Select Producer drop-down list, making it easy to use them again). This value must be unique for each producer added to a remote project.

- Entering the Produce Handle will activate the Registration button.
- Optionally, you can enter the name of the Vendor and a Description of the resource.
- Depending upon the producer you selected, you might also see a list of Extended Registration Properties. These properties are set by the producer and some might require you to provide an accepted value before registration can be completed. Contact the producer for details if you are required to provide any extended properties.

3. Click Register

   The Find Producer window reappears with the producer handle displayed in the Select Producer field.

1. Click Next

   > The Select Portlet from List window appears:

2. Select the portlet you want to use. Note that when selected, details about that portlet appear in the Portlet Details panel:

3. Click Next.

   The Proxy Portlet Details window appears:

4. The window displays pertinent information about the portlet. If you want, you can change the name in Portlet Title to something more meaninful to your portal application; for example:

   The name will appear in the title bar of the portlet when it is rendered in the parent portal.

5. Click Finish.
6. The portlet will be created and appear as a placeholder in the IDE:

   Note the new portlet name in the title bar.

NOTE: You can add additional modes to remote portlets so long as the same mode is not declared by the producer. You will need to specify a content URI for each mode you add.

## Adding the Portlet to a Portal

To add the remote portlet to a portal, do the following (before you begin, ensure that WebLogic Workshop is in the xxxxxxx view and the data palatte is displayed):

1. In WebLogic Workshop, open the portal to which you want to add the portlet.
2. Select the remote portlet from the list of portlets in the data palatte and drag it onto the portal workspace.
3. Save the portal.

## Viewing the Portlet

To test the new remote portlet, do the following:

1. Add the remote portlet to a portal by dragging it into the portal workspace.
2. Start WebLogic Server.
3. In Workshop, open the Portal menu and select Open Current Portal.

   The portal will render in your browser and show the new remote portlet.