Skip navigation.
Downloads | Product Documentation | Support

Using WSRP with WebLogic Portal

# Working with Producers

This section describes how you can modify existing applications to create either complex or simple Producers. It includes information in the following subjects:

- Creating a Producer from a Non-Portal Web Application
- Creating a Simple Producer from a Complex Producer

# Creating a Producer from a Non-Portal Web Application

You can turn a non-portal web application into a Producer. This is helpful when you want to make Java Page Flow or Struts portlets available as remote portlets. It is also helpful for converting applications created outside of WebLogic Workshop into Producers. You can make this conversion in either a portal application or in a non-portal application.

This section includes information on the following subjects:

- Making the Conversion in a Portal Enterprise Application
- Making the Conversion in a Non-Portal Enterprise Application

## Making the Conversion in a Portal Enterprise Application

This section describes how to create a Producer from a non-portal web application.

### Making the Conversion

To convert a non-portal web application in a portal enterprise application into a Producer, use this procedure:

Note: WebLogic Workshop must be running.

1. If the enterprise application is currently not open in WebLogic Workshop, open the enterprise application by selecting File>Open>Application (if it is already open, proceed to step 3).

The Open Workshop Application window appears.

Figure 6-1 Open Workshop Application Window

2. Navigate to and select the appropriate enterprise application (a `*.work` file) and click Open.

Figure 6-2 *.work File Selected

The application appears in the Workshop application tree, as shown in Figure 6-3. Note the non-portal web application listed under the enterprise application.

Figure 6-3 Workshop Application Tree Showing Selected Application

3. Copy the following files from the `WEB-INF/lib` folder under the portal web application to the `WEB-INF/lib` folder under the non-portal web application:

- `wsrp-struts-adapter.jar`
- `wsrp-producer-portal-adapter.jar`
- `netuix_servlet.jar`

4. Right-click the web project you want to convert to a Producer and, from the submenu, select Install > WSRP Producer.

Figure 6-4 Install>WSRP Producer Menus

The project will be installed as a Producer.

5. Verify that the installation was successful by locating the file `wsrp-producer-config.xml` in the `WEB-INF` folder. If it is present, the project was successfully installed as a Producer.

Figure 6-5 Application Tree with wsrp-producer-config.xml Added

### Testing the Configuration

To test the configuration, you need to make the Struts or Pageflow application available as a portlet and then view it in a proxy portlet in another web application. To do so, use the following procedure:

1. Enable a Struts or Pageflow portlet by doing one of the following:

- Copy a Struts or Pageflow `.portlet` file from `<WebLogic813_Home>/portal/portalApp/sampleportal` into the non-portal web application.
- Create a `.portlet` file inside a portal web application and copy the code sample in Listing 6-1 into that file:

Listing 6-1 Code Sample for Creating a .portlet File

>     <?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="portlet_81b"
>                             title="BEA: Non Portal">
>           <netuix:titlebar>
>           </netuix:titlebar>
>           <netuix:content>
>              <netuix:pageflowContent contentUri="/Controller.jpf"/>
>           </netuix:content>
>        </netuix:portlet>
>     </portal:root>

1. If necessary, in the `.portlet` file, update the URI to point to the Struts or Pageflow you want to enable; for example, refer to Listing 6-2

Listing 6-2 Redirecting the URI

>     <netuix:portlet|
>        definitionLabel="portlet_81b"
>                         title="BEA: Non Portal">
>           <netuix:titlebar>
>           </netuix:titlebar>
>           <netuix:content>
>              <netuix:pageflowContent contentUri="/Controller.jpf"/>
>           </netuix:content>
>     </netuix:portlet>

You can also update this URI in the WebLogic Workshop property editor, as shown in Figure 6-6

Figure 6-6 Updating the URI by Using the Property Editor

Note: For instructions on steps 3 and 4, please refer to Building a Remote Portlet in the BEA WebLogic Portal IDE online help system.

1. In a different web application, create a proxy portlet in a WebLogic Portal portal and set the WSDL to reference the Struts or Pageflow portlet you just created; for example:

>     http://localhost:7001/webAppName/producer?wsdl

Where `webAppName` is the web application in which you've stored the `.portlet` file you created in step 1, above.

2. Add the proxy portlet to a portal and view the portal in a browser.

The Struts or Pageflow portlet you created will appear in the browser.

## Making the Conversion in a Non-Portal Enterprise Application

You can also convert a non-portal web application into a Producer from a non-portal enterprise application. This process require adding files that are part of the WebLogic Portal, but you do not need to use WebLogic Workshop.

To convert a non-portal web application into a Producer in a non-portal application, do the following:

1. If your domain is not a portal or a framework domain, you will need to update the domain by doing the following (otherwise, proceed to step 2):

1. Using a text editor such as Notepad, open the `setEnv.cmd` or `setDomainEnv.cmd` (`setEnv.sh/setDomainEnv.sh` for Linux) file and append `%WL_HOME/portal/lib/wsrp/wsrp-common.jar` to the system classpath (`set CLASSPATH=`); for example (Windows):

>     set CLASSPATH=%WEBLOGIC_CLASSPATH%;%POINTBASE_CLASSPATH%;
>           %JAVA_HOME%\jre\lib\rt.jar;%WL_HOME%\server\lib\
>           webservices.jar;%WL_HOME\portal\lib\wsrp\wsrp-common.jar;

or (Linux):

>     CLASSPATH=$WEBLOGIC_CLASSPATH%;%POINTBASE_CLASSPATH%;
>        %JAVA_HOME%\jre\lib\rt.jar;%WL_HOME%\server\lib\webservices.jar
>        ${WEBLOGIC_CLASSPATH}${CLASSPATHSEP}${POINTBASE_CLASSPATH}
>        ${CLASSPATHSEP}${JAVA_HOME}\jre\lib\rt.jar${CLASSPATHSEP}${WL_HOME}
>        /server/lib/webservices.jar"export CLASSPATH;$WL_HOME/portal
>        /lib/wsrp/wsrp-common.jar;

1. Optionally, if you want to enable SSO, deploy the WSRP IdentityAsserter and keystore.

1. In the Producer project`s `web.xml` file, do the following:

1. Add the filter `com.bea.wsrp.producer.adapter.pageflow.WsrpPageflowFilter` (Listing 6-3) and map it to the URL pattern `/producer/*` (Listing 6-4).

Listing 6-3 Adding com.bea.wsrp.producer.adapter.pageflow.WsrpPageflowFilter

>     <filter>
>        <filter-name>WsrpPageflowFilter</filter-name>
>        <filter-class>com.bea.wsrp.producer.adapter.pageflow.WsrpPageflowFilter
>           </filter-class>
>     </filter>

Listing 6-4 Mapping com.bea.wsrp.producer.adapter.pageflow.WsrpPageflowFilter

>     <filter-mapping>
>        <filter-name>WsrpPageflowFilter</filter-name>
>        <url-pattern>/producer/*</url-pattern>
>     </filter-mapping>

1. Add the servlet `com.bea.wsrp.producer.WsrpServer` (Listing 6-5) and map it to the URL pattern `/producer/*` (Listing 6-6) Make sure to set the `<load-on-startup>` parameter in `<servlet>` (Listing 6-5) to ensure that `com.bea.wsrp.producer.WsrpServer` is loaded when the server starts up.

Listing 6-5 Adding com.bea.wsrp.producer.WsrpServer

>     <servlet>
>        <servlet-name>com.bea.wsrp.producer.WsrpServer</servlet-name>
>        <servlet-class>com.bea.wsrp.producer.WsrpServer</servlet-class>
>        <load-on-startup>2</load-on-startup>
>     </servlet>

Listing 6-6 Mapping com.bea.wsrp.producer.WsrpServer

>     <servlet-mapping>
>        <servlet-name>com.bea.wsrp.producer.WsrpServer</servlet-name>
>        <url-pattern>/producer/*</url-pattern>
>     </servlet-mapping>

1. Optionally, if you want to monitor SOAP logs, add the servlet `com.bea.wsrp.logging.MessageMonitor` and map it to `/monitor.`

1. Add the following files to the project's `WEB-INF/lib` folder:

- `$WL_DIR/portal/lib/wsrp/wsrp-producer.jar`
- `$WL_DIR/portal/lib/wsrp/adapter/wsrp-jpf-adapter.jar`
- `$WL_DIR/portal/lib/wsrp/adapter/wsrp-struts-adapter.jar`

2. Add `wsrp-producer-config.xml` to the Producer's `WEB-INF` directory.

Listing 6-7 Contents of wsrp-producer-config.xml

>     <?xml version="1.0" encoding="UTF-8"?>

>     <wsrp-producer-config

>        xmlns="http://www.bea.com/servers/weblogic/wsrp-producer-config/8.0"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

>     xsi:schemaLocation="http://www.bea.com/servers/weblogic/wsrp-producer-config/8.0
>     wsrp-producer-config.xsd">
>     <description></description>

>        <service-config>
>           <registration required="false" secure="false"/>
>           <service-description secure="false"/>
>           <markup secure="false" rewrite-urls="true" transport="string"/>
>           <portlet-management required="false" secure="false"/>
>        </service-config>

>        <supported-locales>
>           <locale>en</locale>
>           <locale>en-US</locale>
>        </supported-locales>

>     </wsrp-producer-config>

Note: If you make any changes to `wsrp-producer-config.xml`, you will need to redeploy or bounce the server before the changes become active.

### Testing the Configuration

To test the configuration, follow the same steps outlined above in Testing the Configuration. To test this configuration, you will need to create the consumer remote portlet (step 2, below) on a separate machine; otherwise the expense of running two domains on a single machine will severely impact performance.

Note: WebLogic Server must be running.

1. In the non-portal web application created under the non-portal enterprise application, create a Struts or pageflow portlet, updating the URI, if necessary.
2. In a portal web application on a separate machine, create a remote portlet and point the WSDL to the non-portal web application under the non-portal enterprise application; for example:

>     http://separate.machine/nonPortalWedApplication/producer?wsdl

(Where `separate.machine` is the name or IP address of the machine hosting the non-portal web application and `nonPortalWedApplication` is the non-portal web application.)

3. Add the remote portlet to a portal and open the portal. If you correctly configured the non-portal web application under the non-portal enterprise application, the Struts or Pageflow portlet you created in step 1 should surface in the portal.

# Creating a Simple Producer from a Complex Producer

Unlike a complex Producer, a simple Producer is a non-portal web application that contains Pageflows and Struts applications. It does not depend upon any portal features (for example, customization). It doesn't allow registration, doesn't support URL rewriting in the Consumer, and does not support portlet customization.

A simple Producer is often advantageous because it easier to manage and you don't need to have the complete portal installed to run it. Simple Producers are commonly used in smaller, departmental settings, where more the more advanced features of complex Producers are not necessary.

By default, all portal projects created with WebLogic Workshop 8.1 SP3 are complex Producers. However, you can create a simple Producer from a complex Producer by following the procedures below.

To create a simple Producer from a complex one, use this procedure.

1. From the complex portlet's `WEB-INF/` directory, open the `wsrp-producer-config.xml file` and locate the `<service-config>` element. It should look like the example in Listing 6-8:

Listing 6-8 <service-config> Element of wsrp-producer-config.xml for a Complex Producer

>     <service-config>
>        <registration required="true" secure="false"/>
>        <service-description secure="false"/>
>        <markup secure="false" rewrite-urls="true" transport="string"/>
>        <portlet-management required="true" secure="false"/>
>     </service-config>

1. Change the `<registration required=>` and `<portlet-management required=>` attributes from `"true"` to `"false"`, It should look like the example in Listing 6-9:

Listing 6-9 Updated <service-config> Element for a Simple Producer

>     <service-config>
>        <registration required="false" secure="false"/>
>        <service-description secure="false"/>
>        <markup secure="false" rewrite-urls="true" transport="string"/>
>        <portlet-management required="false" secure="false"/>
>     </service-config>

Since the markup `<markup secure=>` and service-description `<service-description secure=>` interfaces are mandatory, you don't need to specify any attributes.

1. Redeploy the project.