Portal Federation with WebLogic Portal WRSP: The Basics
WSRP stands for Web Services for Remote Portlets, a handy specification from the folks at OASIS; it provides a standard for portal applications to share portlets between portals. Put another way, WSRP is the ability to produce an interface to useful functionality that can be consumed throughout your enterprise with little or no changes to existing code. Sound familiar?
Almost all of the latest versions of commercial and open source portal products support WSRP, though your mileage may vary based on the vendor. The basic mechanism is the same as any old web service. The producer provides a WSDL that instructs the consumer on how to generate a SOAP request. The difference between web services and WSRP is that with a web service the developers of the consumer application next need to figure out how they will use the SOAP response whereas the WSRP consumer receives a response at the presentation level; all the consumer needs to do is decide where they will display it. The portal frameworks abstract the heavy lifting and all that is required of developers is to configure the producer and consumer to achieve basic WSRP integration. In theory, this simplicity provides all an enterprise needs to reuse portlets across the enterprise "instamagiclly." In practice, business requirements rarely let us get off the hook so easily. In fact, once an enterprise begins to use WSRP, the requirements tend to get more and more complicated, which is why the WebLogic Portal (WLP) has evolved to provide more and more WSRP functionality with increasing ease of development.
When WSRP Makes Sense
WSRP is a technology that provides three benefits. One is reuse; another is performance, (though oftentimes using WSRP will provide only one of these two benefits); and the third is the ability to release portlets asynchronously.
WSRP is not the only approach to achieving portlet reuse. Portlets can also be bundled into a WAR file and used as a shared library, or simply copied from one application to another. Where reuse is the goal, WSRP is the solution of choice when the portlet is used in more than one portal.
Sometimes, portlets are resource intensive. If a portal page contains a collection of portlets where system or network resources impact the usability of the portal, WSRP can provide a strategy where the processing is divided across servers to improve performance.
Portals provide the ability to aggregate access to applications. In many enterprises, these applications are owned and maintained by disparate groups where the coordination of release schedules can be difficult (if not impossible). Here, WSRP provides the advantage of allowing a portlet or group of portlets to be released independently of the main portal application.
The Best Way to Consume a Remote Portlet
In the WebLogic Portal, portlets are WSRP enabled by default since version 9.2, as shown below:
Figure 1: Default Portlet Properties
In fact, the notation in the .portlet file is required only if you are not offering your portlet as remote, as show by these two code snippets:
<netuix:portlet definitionLabel="simpleProducerA_1" title="Simple Producer A"> <netuix:portletdefinitionLabel="nonRemoteExample_1" offerRemote="false"title="Locals Only">
In a WSRP implementation, the remote portal is the producer and the portal displaying the remote portlet is the consumer. The consumer gains access to the producer by registering the producer as a remote producer by accessing the producers WSDL. The WSDL is generated automatically by WLP and available as an address from the producer's web application in the format of [server_address]/[web_application]/producer?wsdl. The example portal applications referenced in this article are named wsrpConsumer and wsrpProducer, with the portal web applications being named wsrpConsumerWEB and wsrpProducerWEB; this would make the producer's WSDL address http://localhost:7001/wsrpProducerWEB/producer?wsdl. This WSDL simply defines key details about interacting with the producer, such as security:
<wssp:SecurityToken TokenType="http://docs.oasis-open.org/wss/2004/01/ oasis-2004-01-saml-token-profile-1.0#SAMLAssertionID">
And where to find various services, such as registration:
<s0:port binding="s3:WSRP_v1_Registration_Binding_SOAP" name="WSRPRegistrationService"> <s4:address location="https://localhost:7002/ wsrpProducerWEB/producer/wsrp-1.0/registration" /> </s0:port>