WSRP Really Works

minceillusionInternet και Εφαρμογές Web

30 Ιουλ 2012 (πριν από 5 χρόνια και 21 μέρες)

334 εμφανίσεις

WSRP Really Works!

(Part 2 of 2)


By Matt Silver

2/1
5
/
20
08

Abstract

A standard from OASIS called Web Services for Remote Portlets (WSRP) is used to
allow portlets to be decoupled from a portal.
In the previous article, we introduced the
relevant standards

ans specifications and then demonstrated WSRP’s capabilities by
consuming a WebSphere Portal portlet within WebLogic Portal
.


In this
second

article, we
explore the reverse scenario by illustrating

WebSphere Portal

acting as the portlet consumer

and WebLo
gic operating as the portlet producer.

Scenario 2:
Web
Sphere

Portal
Acts as a Consumer
and Web
Logic

Portal
Acts as
a
P
roducer


In order for WebSphere Portal to consume a WebLogic Portal portlet, several things need
to happen:




WebLogic Portal

o

Functions a
s a producer

o

Offers (shares) the portlet



WebSphere Portal

o

Functions as a consumer

o

Adds a remote producer

o

Creates a remote portlet

o

Adds the remote portlet to a page


Once again, WebSphere Portal and WebLogic Portal both function as consumers and
producers
without requiring any special setup. However, the other steps still need to be
performed.

WebLogic Portal


Offer a Portlet

WebLogic Portal automatically allows portlets created using WebLogic for Workshop to
be shared. There is a property called
Offer a
s Remote

which is set to
true

by default.
Unfortunately, this property is not visible in the WebLogic Portal Administration
Console. However, below is a figure illustrating the property in WebLogic for
Workshop.


Consequently, there’s nothing you need to

do to share the portlet. This is different from
the way WebSphere Portal behaves, where you have to explicitly share the portlet using
the administration console. Now it’s on to configuring the consumer.

WebSphere Portal
-

Add a Producer

Log onto WebSp
here Portal (e.g.,
http://portalpc:10038/wps/portal
). Click the
Launch

button and select
Administration

to navigate to the WebSphere Portal Administration
Console.


Click the
Web Services
node underneath
Portlet Management

in the navigation bar.


Clic
k the
New Producer

button in the
Web Service Configuration

administration
portlet.


Unlike in WebLogic Portal, there is only one step involved in adding a producer. Enter a
Title

for the producer, which serves as a label. In this case, input
BEA WebLogic

Portal
Server v9.2
. Next, input the
URL to WSDL service definitions
. This URL points to the
WSDL document that contains information about the producer and how to connect to its
services. Specifically, it contains the URLs of the WSRP interfaces support
ed by the
provider. In the case of WebLogic Portal, the standard format for this URL is:


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


In our case, this URL translates to:
http://portalpc:7001/BEAPortalWeb/producer?wsdl
.
Enter this URL.


You’ll notic
e that there is a
Registration
h
andle

text area inside the
New Producer

page. Even though the WebSphere Portal Producer does not support registration, the
WebSphere Portal Consumer can accommodate other producers that do support the
registration interface
. However, leave the field blank. You’ll see why in a moment.



Click
OK

to create the producer.


If WebSphere Portal is able to connect to WebLogic Portal, obtain its service description,
and register, a success message will be displayed at the top o
f the
Web Service
Configuration
portlet.


Click on the pencil (
Edit this Producer
) icon to the right of
BEA WebLogic Portal
v9.2
. Notice that the
Registration handle
, which we had previously left blank, is now
filled in with some value (e.g.,
2005
)
. The
registration handle was created by WebLogic
Portal and passed back to WebSphere Portal during the registration process. Going
forward, WebSphere Portal needs to supply the registration handle whenever it interacts
with any WebLogic Portal, producer offere
d portlet (i.e., BEA Java Portlet). One of the
advantages of the registration handle is that if WebSphere Portal gets deregistered,
WebLogic Portal can delete any instances of the portlets allocated to WebSphere Portal,
thereby leading to better memory ma
nagement.

WebSphere Portal
-

Create a Remote Portlet

Now it’s time to create a remote (proxy) portlet. The process is a bit different from
WebLogic’s. To do so, click the
Web Modules
node under
Portlet Management
in the
navigation bar.


Click the
Consume

button in the
Manage Web Modules
administrative portlet.


In step 1, you must select which producer you want to consume a portlet from. Click the
BEA WebLogic Portal v9.2

producer we just added.


In step 2, you must choose which portlet to consume. Chec
k
BEA Java Portlet
.


Click
OK
. A message indicating the web module has been consumed should appear at
the top of the
Manage Web Modules
portlet.


If you want to see the corresponding web module that was just consumed, select
File
name contains
in the
Se
arch by
drop
-
down menu. Type
BEA
in the
Search
field and
click the
Search
button. The module
WSRP Producer (BEA WebLogic Portal v9.2)
Web Module
will be listed, which indicates that the web module is a producer web
module associated with the
BEA WebLogic

Portal v9.2
producer we configured earlier.


If you want to see that a remote portlet was created, click on the
Portlets

node under
Portlet Management

in the navigation bar. Select
All
remote
portlets
from the
Search
by

drop
-
down menu and click
Search
.


Notice that
BEA Java Portlet
is listed and that the
Remote portlet
column is checked.


WebSphere Portal
-

Add the Remote Portlet to a Page

Adding a remote portlet is just like adding a local portlet to a page. If you’re unfamiliar
with how to do so, ref
er to the WebSphere Portal 6.0 Information Center
(
http://publib.boulder.ibm.com/infocenter/wpdoc/v6r0/index.jsp
).



In our case, we’ve added the local portlet to the left column and the remote portlet to the
right column.

Test the Portlets

Navigate to
the home page for the portal by clicking on the
Launch

button and selecting
Home
. Click the
Page 1

tab to navigate to the page containing our two portlets.


Notice that the remote portlet,
BEA
Java Portlet
, has the same look and feel as the local
portle
t,
IBM
Java Portlet
. The look and feel for a remote portlet can be modified the
same way as the look and feel for a local portlet.


Now try out the two portlets.


In the
IBM Java Portlet

(local portlet), notice that the address that you added earlier,
using the WebLogic Portal desktop, is listed.




Click on the
Details

link next to the address to see the details.




In the
BEA Java Portlet

(local portlet), input a message in the text box. Click the
Update
Message

button. The message should be ech
oed back inside the portlet.


Notice that the remote portlet behaves as we’d expect. This is what we want. It should
be transparent to the end user that the BEA Java Portlet is not hosted by the consumer.


Conclusion

In this article, we saw how to use WS
RP 1.0 to create portals consisting of both local
portlets and remote portlets. We examined the reverse scenario from our pervious article,
with WebSphere Portal serving as a consumer and WebLogic Portal serving as a
producer.


We used each vendor’s por
tal administration console to configure a producer, create a
remote portlet, and add the remote portlet to a page. In the case of WebSphere Portal, we
also needed to explicitly share the portlet. WebLogic Portal shares all portlets created
using WebLogic

for Workshop by default. We also tested the resulting portal pages and
saw that the remote portlets looked and acted like local portlets.


This article series demonstrates an important capability for many enterprises. The ability
to leverage informati
on and capabilities via portal products in a diverse, multi
-
vendor
environment is increasingly important. With rapid growth, mergers and acquisitions, and
even just collaboration between business units, there is increasingly demand for master
information
management. WSRP enables enterprises to move one step closer to robust
and seamless knowledge management.

References



WSRP 1.0 Specification (
http://www.oasis
-
open.org/committees/download.php/3343/oasis
-
200304
-
wsrp
-
specification
-
1.0.pdf
)



BEA WebLogic 9.2
F
ederated Portals Guide

(
http://edocs.bea.com/wlp/docs92/federation/index.html
)



WebSphere Portal 6.0 Information Center
(
http://publib.boulder.ibm.com/infocenter/wpdoc/v6r0/index.jsp
)

Sample Code



BEAPortalEAR.ear


contains the
BEA Java Portlet



IBMPortletWe
b.war


contains the
IBM Java Portlet

Biography

Matt Silver is a courseware developer and trainer, currently serving as a senior consultant
for Web Age Solutions.