Enabling cooperative sources
To enable a cooperative source in preparation for wiring portlets, perform the following steps.
- In the Project Explorer view, select a portlet or the
Portlet Deployment Descriptor. Portlets are displayed when you expand the
Portlet Deployment Descriptor node under the portlet project folder.
- Right-click the desired portlet, and select
Cooperative | Enable this Portlet to Send Data (Source) from the menu. The
Cooperative - Enable this Portlet to Send Data dialog opens. Alternatively, open a JSP page, ensure that it has focus, and select
Page | Cooperative | Enable this Portlet to Send Data (Source) from the menu.
- On the page titled Describe the Type of Data Being Sent, provide values for the following fields:
- Source portlet
- Select the portlet that you want to use as a source. This box will only appear if you have more than one portlet in your workspace.
- Data type URI
- Specify a data type URI. The specified value will be stored in a WSDL file, and will be used to uniquely identify the output property's data type to the cooperative runtime environment. The menu contains all existing Name-Namespace pairs defined in the WSDL.
Note: For a target portlet to receive data from this source it must declare an identical Data type URI.
- Java™ type
- Specify the Java type to be transferred by the source portlet. The value selected in this field will be used to declare the data type in the element of the WSDL.
Click Next.
- On the Property Transfer page, provide values for the following fields:
- [Source action] Name
- Specify the portlet source action. The execution of the specified action will trigger the property broker to send the output property to the target portlet(s).
- For JSR 168 portlet API:
- The Action parameter defaults to ACTION_NAME_PARAM for Basic and Faces portlet types. For Struts, the default value is spf_strutsAction and is not editable.
- Specify the Action value. When the cooperative source is a JSR 168 API portlet, the property broker will look for this particular parameter in the action request. In the example dialog above, when a parameter with the name ACTION_NAME_PARAM and value MyAction is present in an action request, the property broker will recognize that an output property is being published, and will perform the appropriate operations to retrieve the output property value.
- For IBM® portlet API:
- The Action name specified here is the one that this portlet receives as ActionEvent.getActionString().
- For a Faces portlet that uses the IBM portlet API, the action name should be com.ibm.faces.portlet.ACTION.
- Source portlet to portal transfer
Specify the Location and Property name . Certain limitations apply:
- Where location defines the scope where the output property will be made available so that it can be retrieved by the Property Broker.
- Where Property name defines the name of the output property that will be placed in the Property name location.
- You cannot leave the Property name field blank.
- You cannot transfer complex data types using the Request Paramete.
- Click Next
- On the Captions page, enter the following information:
- Resource Bundle
- Choose a properties file from the list, or click
New to define a new properties file
In the Captions fields, specify the following:
- Property caption
- Specify a caption for the parameter that contains the output property. This caption is used by the wiring tool to identify a particular output property.
Note: The field accepts the actual caption value. To specify the key being used, click the Advanced Configuration button.
- Action caption
- Specify a caption for the source action. This caption is used by the wiring tool to identify a particular source action.
Note: The field accepts the actual caption value. To specify the key being used, click the Advanced Configuration button
- Click Next
- For your reference, save the Next Steps page by clicking the link to save the page as HTML. The Next Steps page contains a list of steps and sample code that the user needs to perform in order to transfer data between portlets. You can save this page as an HTML document for further reference and automatically have it open in their external web browser.
- Click OK. The cooperatively-enabled portlet is shown with a source portlet icon ( ) in the Project Explorer view.
The
Enable Cooperative Source action performs the following tasks for you:
- Modifies web.xml to add a servlet class entry to refer to the property broker classes [IBM portlet API only]:
<servlet-class>com.ibm.wps.pb.wrapper.PortletWrapper</servlet-class> <init-param> <param-name>c2a-application-portlet-class</param-name> <param-value>servlet-class</param-value> </init-param>
- Modifies IBM portlet.xml to add configuration parameters to each concrete portlet that exposes actions to the property broker through the WSDL file, and specifies the base name of a national language resource file.
<config-param> <param-name>c2a-action-descriptor</param-name> <param-value>WSDL file</param-value> </config-param> <config-param> <param-name>c2a-nls-file</param-name> <param-value>resource bundle name</param-value> </config-param>Modifies JSR portlet.xml to add configuration parameters to each concrete portlet that exposes actions to the property broker through the WSDL file, and specifies the base name of a national language resource file
<portlet-preferences> <preference> <name>com.ibm.portal.propertybroker.wsdllocation</name> <vlue>/wsdl/Test.wsdl</value> <read-only>true</read-only> </preference> <preference> <name>com.ibm.portal.pagecontext.enable</name> <value>true</value> <read-only>true</read-only> </preference> </portlet-preferences>
- Imports an additional library, pbportlet.jar, to
/WEB-INF/lib in the portlet project for use by the property broker. [IBM portlet API only]
- Creates the specified WSDL file with the following sections:
- <definitions>
- Acts as root.
- <types>
- The data type is declared using XML Schema Datatypes (XSD).
- <message>
- An output message.
- <portType>
- Defines an abstract collection of operations. <output>.
- <binding>
- Always extended to <portlet:binding> to identify the section as a cooperative binding extension for portlet action invocation.
Related concepts
Developing cooperative portlets
Related tasks
Disabling cooperative sources and targets
Disabling a cooperative source for a source or target portlet
Disabling a cooperative target for a target portlet
Disabling one of multiple cooperative sources
Disabling one of multiple cooperative targets
Related reference
Faces direct portlet messaging
Web Services Description Language (WSDL) 1.1
WebSphere Portal Information Center