JBoss.orgCommunity Documentation
The Web Services for Remote Portlets specification defines a web service interface for accessing and interacting with interactive presentation-oriented web services. It has been produced through the efforts of the Web Services for Remote Portlets (WSRP) OASIS Technical Committee. It is based on the requirements gathered and on the concrete proposals made to the committee.
Scenarios that motivate WSRP functionality include:
Content hosts, such as portal servers, providing Portlets as presentation-oriented web services that can be used by aggregation engines.
Aggregating frameworks, including portal servers, consuming presentation-oriented web services offered by content providers and integrating them into the framework.
More information on WSRP can be found on the official website for WSRP. We suggest reading the primer for a good, albeit technical, overview of WSRP.
The WSRP Technical Committee defined WSRP Use Profiles to help with WSRP interoperability. We will refer to terms defined in that document in this section.
GateIn provides a Simple level of support for our WSRP Producer except that out-of-band registration is not currently handled. We support in-band registration and persistent local state (which are defined at the Complex level).
On the Consumer side, GateIn provides a Medium level of support for WSRP, except that we only handle HTML markup (as GateIn itself doesn't handle other markup types). We do support explicit portlet cloning and we fully support the PortletManagement interface.
As far as caching goes, we have Level 1 Producer and Consumer. We support Cookie handling properly on the Consumer and our Producer requires initialization of cookies (as we have found that it improved interoperabilty with some consumers). We don't support custom window states or modes, as GateIn doesn't either. We do, however, support CSS on both the Producer (though it's more a function of the portlets than inherent Producer capability) and Consumer.
While we provide a complete implementation of WSRP 1.0, we do need to go through the Conformance statements and perform more interoperability testing (an area that needs to be better supported by the WSRP Technical Committee and Community at large).
GateIn supports WSRP 2.0 with a complete implementation of the non-optional features. The only features that we have not implemented is support for lifetimes and leasing support.
As of version 3.2 of GateIn, WSRP is only activated and supported when GateIn is deployed on JBoss Application Server.
GateIn provides a complete support of WSRP 1.0 and 2.0 standard interfaces and offers both consumer and
producer services. Starting with version 2.1.0-GA of the component, WSRP is packaged as a GateIn
extension and is now self-contained in an easy to install package named
$JBOSS_PROFILE_HOME/deploy/gatein-wsrp-integration.ear
where
$JBOSS_PROFILE_HOME
refers to your JBoss AS profile directory (default
, for instance).
The extension itself is composed of the following components, assuming
$WSRP_VERSION
(at the time of the writing, it was 2.1.0-GA) is the version of the WSRP component and
$PORTAL_VERSION
(at the time of the writing, it was 3.2.0-GA) is the current GateIn version:
META-INF
contains files necessary for EAR packaging. The only file that is of interest from a user perspective
is
gatein-wsse-consumer.xml
which allows you to configure WS-Security support for the consumer. Please see the
WSRP and WS-Security section for more details.
extension-component-$PORTAL_VERSION.jar
, which contains the components needed to
integrate the WSRP component into GateIn. It also includes the default configuration files for
the WSRP producer and the default WSRP consumers.
extension-config-$PORTAL_VERSION.jar
, which contains the configuration file
needed by the GateIn extension mechanism to properly register this EAR as an extension.
extension-war-$PORTAL_VERSION.war
, which contains the configuration files
needed by the GateIn extension mechanism to properly setup the WSRP service. It includes
wsrp-configuration.xml
which, in particular, configures several options for the
WSRPServiceIntegration
component at the heart of the WSRP integration in GateIn.
lib
, which contains the different libraries needed by the WSRP service.
wsrp-admin-gui-$WSRP_VERSION.war
, which contains the WSRP Configuration portlet
with which you can configure consumers to access remote servers and how the WSRP producer is
configured.
wsrp-producer-jb5wsss-$WSRP_VERSION.war
, which contains the producer-side
support for WS-Security. The only file of interest from a user perspective is
gatein-wsse-producer.xml
which allows you to configure WS-Security support for
the producer. Please see the WSRP and WS-Security section
for more details.
If you're not going to use WSRP in GateIn, it won't adversely affect your installation to leave it
as-is. Otherwise, you can just remove the
gatein-wsrp-integration.ear
file from your AS deploy directory.
JBoss WS (the web service stack that GateIn uses) should take care of the details of updating the port and host name used in WSDL. See the JBoss WS user guide on that subject for more details.
Of course, if you have modified the host name and port on which your server runs, you will need to update the configuration for the consumer used to consume GateIn's 'self' producer. Please refer to the Section 7.7, “Consuming remote WSRP portlets in GateIn” to learn how to do so.
It is possible to use WSRP over SSL for secure exchange of data. Please refer to the instructions on how to do so from GateIn's wiki.
Portlets may present different data or options depending on the currently authenticated user. For remote portlets, this means having to propagate the user credentials from the consumer back to the producer in a safe and secure manner. The WSRP specification does not directly specify how this should be accomplished, but delegates this work to the existing WS-Security standards.
WSRP and WS-Security is currently only supported on GateIn when running on top of JBoss AS 5.
You will want to encrypt the credentials being sent between the consumer and producer, otherwise they will be sent in plain text and could be easily intercepted. You can either configure WS-Security to encrypt and sign the SOAP messages being sent, or secure the transport layer by using an https endpoint. Failure to encrypt the soap message or transport layer will result in the username and password being sent in plain text. Use of encryption is strongly recommended.
When the consumer sends the user credentials to the producer, it is sending the credentials for the currently authenticated user in the consumer. This makes signing in to remote portlets transparent to end users, but also requires that the producer and consumer use the same credentials. This means that the username and password must be the same and valid on both servers.
The recommended approach for this situation would be to use a common ldap configuration. Please see the user guide on how to configure ldap for use with GateIn
The GateIn Wiki article, GateIn WSRP and Web Service Security, also provides a step-by-step example on how to configure WSRP with WS-Security.
GateIn uses JBossWS Native to handle ws-security. Please see the WS-Security section of the JBoss AS 5 Administration and Configuration Guide for indepth configuration options. Please note that since the consumer passes its credentials to the producer, the consumer will act as the wss client and the producer will act as the wss server.
The following are the JBossWS Native configuration files which need to be configure for WSRP:
gatein-wsrp-integration.ear/META-INF/gatein-wsse-consumer.xml
: JBossWS
configuration file for the consumer.
gatein-wsrp-integration.ear/wsrp-producer-jb5wss.war/WEB-INF/conf/gatein-wsse-producer.xml
: JBossWS configuration file for the producer.
Other than the JBossWS configuration file mention above, no other configuration changes should be necessary for the producer.
The consumer requires a few changes before it will function properly with WS-Security. The consumer needs access to the current servlet request since this is used to retrieve the currently authenticated user. In order for the consumer to access this information, it needs a special servlet-filter added to the portal.
In gatein.ear/02portal.war/WEB-INF/web.xml
add the following information:
<!-- Filter to put request and response in ServletAccess -->
<filter>
<filter-name>ServletAccessFilter</filter-name>
<filter-class>org.gatein.wsrp.servlet.ServletAccessFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ServletAccessFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Finally, in the WSRP Configuration portlet, in the consumer configuration options, you will need to check the 'Enable WS Security' checkbox:
In order for the consumer to handle ws-security, the following steps must be completed properly
The JBossWS configuration files must be configured.
The filter must be added to the portal's web.xml.
The enable wss feature must be check in the wsrp admin.
The consumer will not properly handle ws-security unless all 3 are properly configured.
Only JSR-286 (Portlet 2.0) portlets can be made remotable as the mechanism to expose a portlet to WSRP relies on a JSR-286-only functionality.
GateIn does
NOT, by default, expose local portlets for consumption
by remote WSRP consumers. In order to make a portlet remotely available, it must be made "remotable" by marking
it as such in the associated
portlet.xml
. This is accomplished by using a specific
org.gatein.pc.remotable container-runtime-option
. Setting its value to
true
makes the portlet available for remote consumption, while setting its value to
false
will not publish it remotely. As specifying the remotable status for a portlet is optional, you do not need to
do anything if you don't need your portlet to be available remotely.
In the following example, the "BasicPortlet" portlet is specified as being remotable.
Example 7.1.
<?xml version="1.0" standalone="yes"?> <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0"> <portlet-app> <portlet> <portlet-name>BasicPortlet</portlet-name> ... <container-runtime-option> <name>org.gatein.pc.remotable</name> <value>true</value> </container-runtime-option> </portlet> </portlet-app>
It is also possible to specify that all the portlets declared within a given portlet application to be
remotable by default. This is done by specifying the
container-runtime-option
at the
portlet-app
element level. Individual portlets can override that value to not be remotely exposed. Let's look at an
example:
Example 7.2.
<?xml version="1.0" standalone="yes"?> <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0"> <portlet-app> <portlet> <portlet-name>RemotelyExposedPortlet</portlet-name> ... </portlet> <portlet> <portlet-name>NotRemotelyExposedPortlet</portlet-name> ... <container-runtime-option> <name>org.gatein.pc.remotable</name> <value>false</value> </container-runtime-option> </portlet> <container-runtime-option> <name>org.gatein.pc.remotable</name> <value>true</value> </container-runtime-option> </portlet-app>
In the example above, we defined two portlets. The
org.gatein.pc.remotable container-runtime-option
being set to
true
at the
portlet-app
level, all portlets defined in this particular portlet application are exposed remotely by GateIn's
WSRP
producer.
Note, however, that it is possible to override the default behavior: specifying a value for the
org.gatein.pc.remotable container-runtime-option
at the
portlet
level will take precedence over the default. In the example above, the
RemotelyExposedPortlet
inherits the remotable status defined at the
portlet-app
level since it does not specify a value for the org.gatein.pc.remotable container-runtime-option
.
TheNotRemotelyExposedPortlet
, however, overrides the default behavior and is not remotely
exposed. Note that in the absence of a top-level
org.gatein.pc.remotable container-runtime-option
value set to true
, portlets are NOT remotely exposed.
WSRP Producers vary a lot as far as how they are configured. Most of them require that you specify the URL for the Producer's WSDL definition. Please refer to the remote producer's documentation for specific instructions. For instructions on how to do so in GateIn, please refer to Section 7.7, “Consuming remote WSRP portlets in GateIn”.
GateIn's Producer is automatically set up when you deploy a portal instance with the WSRP service.
You can access the WSDL file at
http://{hostname}:{port}/wsrp-producer/v2/MarkupService?wsdl
. If you wish to use only the
WSRP 1 compliant version of the producer, please use the WSDL file found at
http://{hostname}:{port}/wsrp-producer/v1/MarkupService?wsdl
.
The default hostname is
localhost
and the default port is 8080.
To be able to consume WSRP portlets exposed by a remote producer, GateIn's WSRP consumer needs to know how to access that remote producer. One can configure access to a remote producer using the provided configuration portlet. Alternatively, it is also possible to configure access to remote producers using an XML descriptor, though it is recommended (and easier) to do so via the configuration portlet.
Once a remote producer has been configured, the portlets that it exposes are then available in the Application Registry to be added to categories and then to pages.
Let's work through the steps of defining access to a remote producer using the configuration portlet so that its portlets can be consumed within GateIn. We will configure access to NetUnity's public WSRP producer.
Some WSRP producers do not support chunked encoding that is activated by default by JBoss WS. If your
producer does not support chunked encoding, your consumer will not be able to properly connect to the
producer. This will manifest itself with the following error:
Caused by: org.jboss.ws.WSException: Invalid HTTP server response [503] - Service
Unavailable
.
Please see this GateIn's
wiki page
for more details.
GateIn provides a portlet to configure access (among other functions) to remote WSRP Producers graphically. Starting with 3.2, the WSRP configuration portlet is installed by default. You can find it at http://localhost:8080/portal/login?initialURI=%2Fportal%2Fprivate%2Fclassic%2FwsrpConfigurationp&username=root&password=gtn
You should see a screen similar to:
This screen presents all the configured Consumers associated with their status and possible actions on them. A Consumer can be active or inactive. Activating a Consumer means that it is ready to act as a portlet provider. Note also that a Consumer can be marked as requiring refresh meaning that the information held about it might not be up to date and refreshing it from the remote Producer might be a good idea. This can happen for several reasons: the service description for that remote Producer has not been fetched yet, the cached version has expired or modifications have been made to the configuration that could potentially invalidate it, thus requiring re-validation of the information.
The WSRP configuration didn't use to be installed by default in previous versions of GateIn. We include here the legacy instructions on how to install this portlet in case you ever need to re-install it.
Use the usual procedure to log in as a Portal administrator and go to the Application Registry. With the default install, you can just go to http://localhost:8080/portal/login?initialURI=%2Fportal%2Fprivate%2Fclassic%2Fadministration%2Fregistry&username=root&password=gtn Add the WSRP Configuration portlet to the Administration category. If you use the Import Applications functionality, the WSRP Configuration portlet will be automatically added to the Administration category.
Now that the portlet is added to a category, it can be added to a page and used. We recommend adding it to the same page as the Application Registry as operations relating to WSRP and adding portlets to categories are somewhat related as we will see. Go ahead and add the WSRP Configuration portlet to the page using the standard procedure.
Next, we create a new Consumer which we will call netunity
. Type
"netunity
" in
the "Create a consumer named:" field then click on "Create consumer":
You should now see a form allowing you to enter/modify the information about the Consumer. Set the cache expiration value to 300 seconds, leave the default timeout value for web services (WS) operations and enter the WSDL URL for the producer in the text field and press the "Refresh & Save" button:
This will retrieve the service description associated with the Producer which WSRP interface is described by the WSDL file found at the URL you just entered. In our case, querying the service description will allow us to learn that the Producer requires registration, requested three registration properties and that we are missing values for these properties:
This particular producer requests simple
Yes
or
No
values for the three registration properties. Entering No
,
Yes
and
No
(in that order) for the values and then pressing the "Refresh & Save" button should result in:
At this point, there is no automated way to learn about which possible values (if any) are expected by the remote Producer. Sometimes, the possible values will be indicated in the registration property description but this is not always the case... Please refer to the specific Producer's documentation.
If we had been dealing with a producer which required registration but didn't require any registration
properties, as is the case for the
selfv2
consumer (the consumer that accesses the portlets made remotely available by GateIn's producer via
WSRP 2), we'd have seen something similar to the screenshot below, after pressing the "Refresh & Save" button:
While we recommend you use the WSRP Configuration portlet to configure Consumers, we provide an
alternative way to configure consumers by adding an XML file called
wsrp-consumers-config.xml
in the
$JBOSS_PROFILE_HOME/conf/gatein/
directory.
An XML Schema defining which elements are available to configure Consumers via XML can be found
in
$JBOSS_PROFILE_HOME/deploy/gatein-wsrp-integration.ear/lib/wsrp-integration-api-$WSRP_VERSION.jar/xsd/gatein_wsrp_consumer_1_0.xsd
It is important to note that once the XML configuration file for consumers has been read upon the WSRP service first start, the associated information is put under control of JCR (Java Content Repository). Subsequent launches of the WSRP service will use the JCR-stored information and ignore the content of the XML configuration file.
Let's now look at which information needs to be provided to configure access to a remote producer.
First, we need to provide an identifier for the producer we are configuring so that we can refer to it
afterwards. This is accomplished via the mandatory
id
attribute of the
<wsrp-producer>
element.
GateIn also needs to learn about the remote producer's endpoints to be able to connect to the
remote web services and perform WSRP invocations. This is accomplished by specifying the URL for the
WSDL description for the remote WSRP service, using the
<endpoint-wsdl-url>
element.
Both the
id
attribute and
<endpoint-wsdl-url>
elements are required for a functional remote producer configuration.
It is also possible to provide addtional configuration, which, in some cases, might be important to establish a proper connection to the remote producer.
One such optional configuration concerns caching. To prevent useless roundtrips between the local
consumer and the remote producer, it is possible to cache some of the information sent by the producer
(such as the list of offered portlets) for a given duration. The rate at which the information is
refreshed is
defined by the
expiration-cache
attribute of the
<wsrp-producer>
element which specifies the refreshing period in seconds. For example, providing a value of 120 for
expiration-cache means that the producer information will not be refreshed for 2 minutes after it has
been somehow accessed. If no value is provided, GateIn will always access the remote producer
regardless of whether the remote information has changed or not. Since, in most instances, the
information provided by the producer does not change often, we recommend that you use this caching
facility to minimize bandwidth usage.
It is also possible to define a timeout after which WS operations are considered as failed. This is
helpful to avoid blocking the WSRP service, waiting forever on the service that doesn't answer. Use the
ws-timeout
attribute of the
<wsrp-producer>
element to specify how many milliseconds the WSRP service will wait for a response from the remote
producer before timing out and giving up.
Additionally, some producers require consumers to register with them before authorizing them to access their offered portlets. If you know that information beforehand, you can provide the required registration information in the producer configuration so that the consumer can register with the remote producer when required.
At this time, though, only simple String properties are supported and it is not possible to configure complex registration data. This should, however, be sufficient for most cases.
Registration configuration is done via the
<registration-data>
element. Since GateIn can generate the mandatory information for you, if the remote producer does
not require any registration properties, you only need to provide an empty
<registration-data>
element. Values for the registration properties
required by the remote producer can be provided via
<property>
elements. See the example below for more details. Additionally, you can override the default consumer
name automatically provided by GateIn via the
<consumer-name>
element. If you choose to provide a consumer name, please remember that this should uniquely identify
your consumer.
Here is the configuration of the
selfv1
and
selfv2
consumers as found in
$JBOSS_PROFILE_HOME/deploy/gatein-wsrp-integration.ear/lib/extension-component-$WSRP_VERSION.jar/conf/wsrp-consumers-config.xml
with a cache expiring every 500 seconds and with a 50 second timeout for web service operations.
This file contains the default configuration and you shouldn't need to edit it. If you want to make modifications to it, we recommend that you follow the procedure detailed in Section 7.7.2, “Configuring a remote producer using the configuration portlet”.
Example 7.3.
<?xml version='1.0' encoding='UTF-8' ?> <deployments xmlns="http://www.gatein.org/xml/ns/gatein_wsrp_consumer_1_0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_wsrp_consumer_1_0 http://www.jboss.org/portal/xsd/gatein_wsrp_consumer_1_0.xsd"> <deployment> <wsrp-producer id="selfv1" expiration-cache="500" ws-timeout="50000"> <endpoint-wsdl-url>http://localhost:8080/wsrp-producer/v1/MarkupService?wsdl</endpoint-wsdl-url> <registration-data/> </wsrp-producer> </deployment> <deployment> <wsrp-producer id="selfv2" expiration-cache="500" ws-timeout="50000"> <endpoint-wsdl-url>http://localhost:8080/wsrp-producer/v2/MarkupService?wsdl</endpoint-wsdl-url> <registration-data/> </wsrp-producer> </deployment> </deployments>
Here is an example of a WSRP descriptor with registration data and cache expiring every minute:
Example 7.4.
<?xml version='1.0' encoding='UTF-8' ?> <deployments xmlns="http://www.gatein.org/xml/ns/gatein_wsrp_consumer_1_0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_wsrp_consumer_1_0 http://www.jboss.org/portal/xsd/gatein_wsrp_consumer_1_0.xsd"> <deployments> <deployment> <wsrp-producer id="AnotherProducer" expiration-cache="60"> <endpoint-wsdl-url>http://example.com/producer/producer?WSDL</endpoint-wsdl-url> <registration-data> <property> <name>property name</name> <lang>en</lang> <value>property value</value> </property> </registration-data> </wsrp-producer> </deployment> </deployments>
If we go to the Application Registry and examine the available portlets by clicking on the Portlet link, you will now be able to see remote portlets if you click on the REMOTE tab in the left column:
These portlets are, of course, available to be used such as regular portlets: they can be used in categories and added to pages. If you use the Import Applications functionality, they will also be automatically imported in categories based on the keywords they define.
More specifically, if you want to add a WSRP portlet to a category, you can access these portlets by
selecting
wsrp
in the Application Type drop-down menu:
Since remote portlets can be manipulated just like regular portlets, you can add them to pages just like you would do for a regular portlet. Please refer to the appropriate section of the documentation for how to do so.
Of note, though, is that, starting with version 3.2 of GateIn (5.2 of EPP), it is now possible to also add a
remote portlet to a
pages.xml
configuration file.
This is accomplished using the
<wsrp>
element instead of the
<portlet>
element in your
pages.xml
document. While
<portlet>
references a local portlet using the name of the application in which the portlet is contained and the
portlet name itself to identify which portlet to use,
<wsrp>
references a remote portlet using a combination of the consumer identifier for the producer publishing the
portlet and the portlet handle identifying the portlet within the context of the producer.
The format for such a reference to a remote portlet is a follows: first, the identifier of the
consumer that accesses the remote producer publishing the remote portlet, then a separator (currently a
period (.
)) and finally the portlet handle for that
portlet, which is a string provided by the producer to identify the portlet.
Since there currently is no easy way to determine the correct portlet handle, we recommend that you use the
graphical user interface to add remote portlets to pages instead of using
pages.xml
.
For remote portlets published by GateIn's WSRP producer, the portlet handles are, at
the time of this writing, following the
/<portlet application name>.<portlet name>
format.
In the following example, we define 2 portlets for a page named
Test
in our
pages.xml
configuration. They are actually references to the same portlet, albeit one accessed locally and the
other
one accessing it via the
selfv2
consumer which consumes GateIn's WSRP producer. You can see that the first one is local (the
<portlet-application>
with the
'Added locally
'
title) and follows the usual declaration. The second portlet (the one with the
'Added from selfv2 consumer
'
title) comes from the
selfv2
consumer and uses the
<wsrp>
element instead of
<portlet>
element and follows the format for portlets coming from the GateIn's WSRP producer.
Example 7.5.
<page> <name>Test</name> ... <portlet-application> <portlet> <application-ref>richFacesPortlet</application-ref> <portlet-ref>richFacesPortlet</portlet-ref> </portlet> <title>Added locally</title> ... </portlet-application> <portlet-application> <wsrp>selfv2./richFacesPortlet.richFacesPortlet</wsrp> <title>Added from selfv2 consumer</title> ... </portlet-application> </page>
Producers often offer several levels of service depending on consumers' subscription levels (for example). This is implemented at the WSRP level with the registration concept: producers can assert which level of service to provide to consumers based on the values of given registration properties.
There might also be cases where you just want to update the registration information because it has changed. For example, the producer required you to provide a valid email and the previously email address is not valid anymore and needs to be updated.
It is therefore sometimes necessary to modify the registration that concretizes the service agreement
between a consumer and a producer. Let's take the example of a producer requiring a valid email (via an
email
registration property) as part of its required information that consumers need to provide to be properly
registered.
Suppose now that we would like to update the email address that we provided to the remote producer when
we first registered. We will need to tell the producer that our registration data has been modified.
Let's see how to do this. Select the consumer for the remote producer in the available consumers list to
display its configuration. Assuming you want to change the email you registered with to
foo@example.com
, change its value in the field for the
email
registration property:
Now click on "Update properties" to save the change. A "Modify registration" button should now appear to let you send this new data to the remote producer:
Click on this new button and, if everything went well and your updated registration has been accepted by the remote producer, you should see something similar to:
It can also happen that a producer administrator decided to change its requirement for registered
consumers. GateIn will attempt to help you in this situation. Let's walk through an example using
the selfv2
consumer. Let's assume that registration is requiring a valid value for an
email
registration property. If you go to the configuration screen for this consumer, you should see:
Now suppose that the administrator of the producer now additionaly requires a value to be provided for a
name
registration property. We will actually see how to do perform this operation
in GateIn when we examine how to configure GateIn's producer in
Section 7.9, “Configuring GateIn's WSRP Producer”.
Operations with this producer will now fail. If you suspect that a registration modification is required,
you should go to the configuration screen for this remote producer and refresh the information held by
the consumer by pressing "Refresh & Save":
As you can see, the configuration screen now shows the currently held registration information and
the expected information from the producer. Enter a value for the
name
property
and then click on "Modify registration". If all went well and the producer accepted your new registration
data, you should see something similar to:
WSRP 1 makes it rather difficult to ascertain for sure what caused an
OperationFailedFault
as it is the generic exception returned by
producers if something didn't quite happen as expected during a method invocation. This means that
OperationFailedFault
can be caused by several different reasons, one
of them being a request to modify the registration data. Please take a look at the log files to see
if you can gather more information as to what happened. WSRP 2 introduces an exception that is
specific to a request to modify registrations thus reducing the ambiguity that exists when using WSRP 1.
Several operations are available from the consumer list view of the WSRP configuration portlet:
The available operations are:
Configure: displays the consumer details and allows user to edit them
Refresh: forces the consumer to retrieve the service description from the remote producer to refresh the local information (offered portlets, registration information, etc.)
Activate/Deactivate: activates/deactivates a consumer, governing whether it will be available to provide portlets and receive portlet invocations
Register/Deregister: registers/deregisters a consumer based on whether registration is required and/or acquired
Delete: destroys the consumer, after deregistering it if it was registered
Export: exports some or all of the consumer's portlets to be able to later import them in a different context
Import: imports some or all of previously exported portlets
Import/Export functionality is only available to WSRP 2 consumers of producers that support this optional functionality. Import functionality is only available if portlets had previously been exported.
Import and export are new functionalities added in WSRP 2. Exporting a portlet allows a consumer to get an opaque representation of the portlet which can then be use by the corresponding import operation to reconstitute it. It is mostly used in migration scenarios during batch operations. Since GateIn does not currently support automated migration of portal data, the functionality that we provide as part of WSRP 2 is necessarily less complete than it could be with full portal support.
The import/export implementation in GateIn (available since 3.1) allows users to export portlets from a given consumer. These portlets can then be used to replace existing content on pages. This is accomplished by assigning previously exported portlets to replace the content displayed by windows on the portal's pages. Let us walk through an example to make things clearer.
Clicking on the "Export" action for a given consumer will display the list of portlets currently made available by this specific consumer. An example of such a list is shown below:
Once portlets have been selected, they can be exported by clicking on the "Export" button thus making them available for later import:
You can re-import the portlets directly by pressing the "Use for import" button or, on the Consumers list page, using the "Import" action for a given consumer. Let's assume that you used that second option and that you currently have several available sets of previously exported portlets to import from. After clicking the action link, you should see a screen similar to the one below:
As you can see this screen presents the list of available exports with available operations for each.
View: displays the export details as previously seen when the export was first performed
Delete: deletes the selected export, asking you for confirmation first
Use for import: selects the export to import portlets from
Once you've selected an export to import from, you will see a screen similar to the one below:
The screen displays the list of available exported portlets for the previously selected export. You can
select which portlet you want to import by checking the checkbox next to its name. Next, you need to select
the content of which window the imported portlet will replace. This process is done in three steps. Let's
assume in this example that you have the following page called
page1
and containing two windows called
NetUnity WSRP 2 Interop - Cache Markup (remote)
and
/samples-remotecontroller-portlet.RemoteControl (remote)
as shown below:
In this example, we want to replace the content of the
/samples-remotecontroller-portlet.RemoteControl (remote)
by the content of the
/ajaxPortlet.JSFAJAXPortlet
portlet that we previously exported. To do so, we will check the checkbox next to the
/ajaxPortlet.JSFAJAXPortlet
portlet name to indicate that we want to import its data and then select the
page1
in the list of available pages. The screen will then refresh to display the list of available windows on
that page, similar to the one seen below:
Note that, at this point, we still need to select the window which content we want to replace before
being able to complete the import operation. Let's select the
/samples-remotecontroller-portlet.RemoteControl (remote)
window, at which point the "Import" button will become enabled, indicating that we now have all the
necessary data to perform the import. If all goes well, pressing that button should result in a screen
similar to the one below:
If you now take a look at the
page1
page, you should now see that the content
/samples-remotecontroller-portlet.RemoteControl (remote)
window has been replaced by the content of the
/ajaxPortlet.JSFAJAXPortlet
imported portlet and the window renamed appropriately:
There are rare cases where it might be required to erase the local information without being able to deregister first. This is the case when a consumer is registered with a producer that has been modified by its administrator to not require registration anymore. If that ever was to happen (most likely, it won't), you can erase the local registration information from the consumer so that it can resume interacting with the remote producer. To do so, click on "Erase local registration" button next to the registration context information on the consumer configuration screen:
Warning: This operation is dangerous as it can result in inability to interact with the remote producer if invoked when not required. A warning screen will be displayed to give you a chance to change your mind:
The preferred way to configure the behavior of Portal's WSRP Producer is via the WSRP configuration portlet.
Alternatively, it is possible to add an XML file called
wsrp-producer-config.xml
in the
$JBOSS_PROFILE_HOME/conf/gatein/
directory.
Several aspects can be modified with respects to whether registration is required for consumers to access
the Producer's services.
An XML Schema defining which elements are available to configure Consumers via XML can be found
in
$JBOSS_PROFILE_HOME/deploy/gatein-wsrp-integration.ear/lib/wsrp-integration-api-$WSRP_VERSION.jar/xsd/gatein_wsrp_producer_1_0.xsd
It is important to note that once the XML configuration file for the producer has been read upon the WSRP service first start, the associated information is put under control of JCR (Java Content Repository). Subsequent launches of the WSRP service will use the JCR-stored information and ignore the content of the XML configuration file.
The default configuration file for the producer can be found at
$JBOSS_PROFILE_HOME/deploy/gatein-wsrp-integration.ear/lib/extension-component-$WSRP_VERSION.jar/conf/wsrp-producer-config.xml
The default producer configuration is to require that consumers register with it before providing access its
services but does not require any specific registration properties (apart from what is mandated by the
WSRP standard). It does, however, require consumers to be registered before sending them a full service
description. This means that our WSRP producer will not provide the list of offered portlets and other
capabilities to unregistered consumers. The producer also uses the default
RegistrationPolicy
paired with the default
RegistrationPropertyValidator
. We will look into property
validators in greater detail later inSection 7.9.3, “Registration configuration”. Suffice to say for now
that this allows users to customize how Portal's WSRP Producer decides whether a given registration property
is valid or not.
GateIn provides a web interface to configure the producer's behavior. You can access it by clicking on the "Producer Configuration" tab of the "WSRP" page of the "admin" portal. Here's what you should see with the default configuration:
As would be expected, you can specify whether or not the producer will send the full service description to
unregistered consumers, and, if it requires registration, which
RegistrationPolicy
to use (and, if needed, which
RegistrationPropertyValidator
), along with required
registration property description for which consumers must provide acceptable values to successfully
register.
New in GateIn 3.2, we now display the WSDL URLs to access GateIn's WSRP producer either in WSRP 1 or WSRP 2 mode.
In order to require consumers to register with Portal's producer before interacting with it, you need to configure Portal's behavior with respect to registration. Registration is optional, as are registration properties. The producer can require registration without requiring consumers to pass any registration properties as is the case in the default configuration. Let's configure our producer starting with a blank state:
We will allow unregistered consumers to see the list of offered portlets so we leave the first checkbox ("Access to full service description requires consumers to be registered.") unchecked. We will, however, specify that consumers will need to be registered to be able to interact with our producer. Check the second checkbox ("Requires registration. Modifying this information will trigger invalidation of consumer registrations."). The screen should now refresh and display:
You can specify the fully-qualified name for your
RegistrationPolicy
and
RegistrationPropertyValidator
there. We will keep the default value. See
Section 7.9.3.1, “Customization of Registration handling behavior”
for more details. Let's add, however, a registration property called
email
. Click "Add property" and enter the appropriate information in the fields,
providing a description for the registration property that can be used by consumers to figure out its
purpose:
Press "Save" to record your modifications.
At this time, only String (xsd:string) properties are supported. If your application requires more complex properties, please let us know.
If consumers are already registered with the producer, modifying the configuration of required registration information will trigger the invalidation of held registrations, requiring consumers to modify their registration before being able to access the producer again. We saw the consumer side of that process in Section 7.8.1.2, “Registration modification on producer error”.
Registration handling behavior can be customized by users to suit their Producer needs. This is
accomplished by providing an implementation of the
RegistrationPolicy
interface. This interface defines methods that are called by Portal's Registration service so that
decisions can be made appropriately. A default registration policy that provides basic
behavior is provided and should be enough for most user needs.
While the default registration policy provides default behavior for most registration-related aspects,
there is still one aspect that requires configuration: whether a given value for a registration property
is acceptable by the WSRP Producer. This is accomplished by plugging a
RegistrationPropertyValidator
in the default registration policy. This allows users to define their own validation mechanism.
Please refer to the
Javadoc™
for
org.gatein.registration.RegistrationPolicy
and
org.gatein.registration.policies.RegistrationPropertyValidator
for more
details on what is expected of each method.
Defining a registration policy is required for the producer to be correctly configured. This is accomplished by specifying the qualified class name of the registration policy. Since we anticipate that most users will use the default registration policy, it is possible to provide the class name of your custom property validator instead to customize the default registration policy behavior. Note that property validators are only used by the default policy.
Since the policy or the validator are defined via their class name and dynamically loaded, it is important that you make sure that the identified class is available to the application server. One way to accomplish that is to deploy your policy implementation as JAR file in your AS instance deploy directory. Note also that, since both policies and validators are dynamically instantiated, they must provide a default, no-argument constructor.
The lack of conformance kit and the wording of the WSRP specification leaves room for differing interpretations, resulting in interoperability issues. It is therefore possible to encounter issues when using consumers from different vendors. We have experienced such issues and have introduced a way to relax the validation that our WSRP producer performs on the data provided by consumers to help with interoperability by accepting data that would normally be invalid. Note that we only relax our validation algorithm on aspects of the specification that are deemed harmless such as invalid language codes.
By default, the WSRP producer is configured in strict mode. If you experience issues with a given consumer, you might want to try to relax the validation mode. This is accomplished by unchecking the "Use strict WSRP compliance." checkbox on the Producer configuration screen.