<<

. 72
( 87 .)



>>

lowing settings in WP_ROOT/shared/app/config/services/Config
Service.properties:
1. Set portal.enable.jsr168=true.
2. Set portal.enable.wsrp=true.
3. Restart the portal instance.
In addition to these mandatory settings, there are a few additional con-
¬guration settings that may be appropriate for your environment. These
include proxy settings and security settings.
In terms of proxy settings you may want to con¬gure a proxy for WSRP.
Unfortunately, you cannot specify a proxy for WSRP communication only”
this will affect all communications. To do this you need to change the JVM
arguments for the WP/WAS instance using -DproxyHost and
-DproxyPort.
In terms of advanced security con¬guration, you can enable WSRP com-
munications over SSL and you can implement additional security for URLs
exposed through WSRP. To enable SSL for WSRP communications, you
¬rst need to enable SSL for your WP and WAS instances. Then you need
to activate WSRP security by setting wsrp.security.enabled=true in
WP-ROOT/shared/app/config/services/ConfigService.
properties.
Controlling security for URLs exposed through WSRP is important be-
cause WSRP allows you to use content generated by a remote producer. In
P1: FCH/SPH P2: FCH/SPH QC: FCH/SPH T1: FCH
WY009-22 WY009-BenNatan-v1.cls May 11, 2004 14:53




432 Chapter 22


such scenarios you have little control over the links provided in the markup
and, therefore, where your users may be taken in terms of link navigation.
You provide this control by implementing the WSRPResourceURLFil-
terFactory interface and register your class with WP. This registration
is done through the wsrp.resource.url.filter.factory property in
WP_ROOT/shared/app/config/services/ConfigService.
properties, which should name the class you create. The interface to
be implemented is shown below and is used by consumers as they process
resource URLs:
package com.ibm.wps.wsrp.Consumer.security;

/**
* This interface describes a factory that can be used
* to provide a <code>java.io.Writer</code> and
* <code>java.io.Reader</code> which are used to encode and decode
* resource URLs used by the WSRP Consumer. The reader and writer
* implementation should be symmetric.
*
* This provides a plug-point for custom resource URL filters
* that can, for example, be used to encrypt and decrypt WSRP
*resource URLs.
**/
public interface WSRPResourceURLFilterFactory
{
/**
* Get the <code>java.io.Writer</code> used to filter the passed
* Writer. WSRP Resource URLs are written to that Writer.
* An implementation of this Writer could for example encrypt
written
* resource URLs. It is important that writing to that Writer does
* not generate characters that are reserved in URIs. See
* <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396</a> for a
list
* of reserved URI characters.
*
* @param out The underlying character stream
* @return A <code>java.io.Writer</code> which can be used to modify
* WSRP resource URLs written to it.
**/
public java.io.Writer getUrlFilterWriter(java.io.Writer out);
/**
* Get the Reader used to modify the characters passed to the
Reader.
* Requested WSRP Resource URLs are read from that Reader.
* An implementation of this Reader could, for example, decrypt
* WSRP resource URLs which have been encrypted using the previous
Writer.
*
* @param out The underlying character input stream
P1: FCH/SPH P2: FCH/SPH QC: FCH/SPH T1: FCH
WY009-22 WY009-BenNatan-v1.cls May 11, 2004 14:53




WebSphere Portal Support for Web Services and Remote Portlets 433


* @return A <code>java.io.Reader</code> which is used to modify
WSRP
* resource URLs read from it.
**/
public java.io.Reader getUrlFilterReader(java.io.Reader in);
}



Setting Up WSRP Producers
WSRP producer support within WP includes the entire remote portlet life
cycle including adding services, removing services, and exporting portlets.
In order to add a WSRP portlet service, use the XML con¬guration with the
following XML:
<?xml version="1.0" encoding="UTF-8" ?>
<request type="update" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance" xsi:noNamespaceSchemaLocation="PortalConfig_1.2.xsd">
<portal action="locate">
<web-app action="locate" active="true" uid="portlet.war.webmod">
<portlet-app action="update" uid="stdTestsuite.war">
<portlet action="update" name="TestPortlet1" provided=”true” />
</portlet-app>
</web-app>
</portal>
</request>

In order to remove a service, use a similar XML command except for
changing the provided attribute to false:
<?xml version="1.0" encoding="UTF-8" ?>
<request type="update" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance" xsi:noNamespaceSchemaLocation="PortalConfig_1.2.xsd">
<portal action="locate">
<web-app action="locate" active="true" uid="portlet.war.webmod">
<portlet-app action="update" uid="stdTestsuite.war">
<portlet action="update" name="TestPortlet1" provided=”false” />
</portlet-app>
</web-app>
</portal>
</request>
Finally, to export the WSRP portlets use the XML ¬le provided in
WP_ROOT/doc/xml-samples/ExportAllPortlets.xml and search
for WSRP producers or portlets that have the provided attribute set to
true:
<?xml version="1.0" encoding="UTF-8"?>
<request
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="PortalConfig_1.2.xsd"
P1: FCH/SPH P2: FCH/SPH QC: FCH/SPH T1: FCH
WY009-22 WY009-BenNatan-v1.cls May 11, 2004 14:53




434 Chapter 22


type="export">
<portal action="locate">
<wsrp-producer objectid="*" action="export"/>
</portal>
</request>

<?xml version="1.0" encoding="UTF-8"?>
<request
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="PortalConfig_1.2.xsd"
type="export">
<portal action="locate">
<portlet provided="true" action="export"/>
</portal>
</request>



Setting Up WSRP Consumers
To set up a consumer you ¬rst need to create a producer instance within
WP. This may be a little confusing at ¬rst but WP needs to know about
the service de¬nitions or the producer™s WSDL de¬nitions in order for a
consumer to be created. To create the producer speci¬cation using a WSDL
de¬nition, use the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<request type="update" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance" xsi:noNamespaceSchemaLocation="PortalConfig_1.2.1.xsd" create-
oids="true">
<portal action="locate">
<wsrp-producer action="update" registration-required="false"
uniquename="wps.myProducer">
<wsdl-url>
http://hostname/wsdl/wsrp_service.wsdl
</wsdl-url>
<localedata locale="en">
<title>My Producer</title>
</localedata>
</wsrp-producer>
</portal>
</request>

Alternatively, you can create the producer using a service description
URL and a markup URL. This is useful when you don™t have direct access
to the remote portlet and its WSDL when creating the producer and con-
sumer. You will need the remote portlet to be available at runtime in order
to use it, but you may not need it when you are setting up the consumer. In
this case use the following XML:
<?xml version="1.0" encoding="UTF-8" ?>
<request type="update" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
P1: FCH/SPH P2: FCH/SPH QC: FCH/SPH T1: FCH
WY009-22 WY009-BenNatan-v1.cls May 11, 2004 14:53




WebSphere Portal Support for Web Services and Remote Portlets 435


instance" xsi:noNamespaceSchemaLocation="PortalConfig_1.2.1.xsd" create-
oids="true">
<portal action="locate">
<wsrp-producer action="update" uniquename="wps.myProducer">
<service-description-url>
http://hostname/wps/WSRPServiceDescriptionService
</service-description-url>
<markup-url>
http://hostname/wps/WSRPBaseService
</markup-url>
<localedata locale="en">
<title>My Producer</title>
</localedata>
</wsrp-producer>
</portal>
</request>

Once you create the producer de¬nition, you can go ahead and de¬ne
the consumer using this producer. In order to do this you need to provide
the handle and groupID for the remote portlet:

<?xml version="1.0" encoding="UTF-8"?>
<request type="update" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance" xsi:noNamespaceSchemaLocation="PortalConfig_1.2.1.xsd">
<portal action="locate">
<wsrp-producer action="locate" uniquename="wps.myProducer">
<portlet-app action="update" active="true"
groupid="_2_00KJL5N5NE0U0FIA_LT">
<portlet action="update" active="true" defaultlocale="en"
handle="_5_00KJL5N5NE0U0FIA_FN" name="WSRP">
<localedata locale="en">
<title>WSRP</title>
<description>Sample WSRP</description>
</localedata>
<access-control externalized="false" owner="undefined"
private="false"/>
</portlet>
</portlet-app>
</wsrp-producer>
</portal>
</request>

Once you de¬ne the consumer you can use the normal portal administra-
tion to add the remote portlets; at this point there is no difference between
these WSRP consumers and other local portlets.
By default WP caches producer service descriptions once they have been
de¬ned within a consumer. This allows WP to avoid multiple network
requests when numerous services are being used. In some cases you might
want to disable this caching while troubleshooting WSRP support. To do this
set cacheinstance.wsrp.cache.servicedescription.enabled
P1: FCH/SPH P2: FCH/SPH QC: FCH/SPH T1: FCH
WY009-22 WY009-BenNatan-v1.cls May 11, 2004 14:53




436 Chapter 22


= false in WP_ROOT/shared/app/config/services/Cache Man-
agerService. properties.


Futures
WSRP support in WP 5.0.2 is a technology preview. Future versions of
WP will provide more robustness and more functions than the current im-
plementation. Among these added features you should keep in mind that

<<

. 72
( 87 .)



>>