Interoperability Solutions for
Web Services Remote Portlets (WSRP)

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

WSRP Interoperability Example

The examples described in this section support AquaLogic Service Bus versions 2.0, 2.1 and 2.5 (see Example Prerequisites).

This section describes a WSRP interoperability example. It contains the following topics:

 


Example Prerequisites

The WSRP interoperability example assumes the following components and configuration:

For an AquaLogic Service Bus configuration that supports the configuration defined in this example, see the AquaLogic Service Bus/WSRP code sample, available from the AquaLogic Service Bus code samples page on BEA dev2dev:

 


Example Projects and Folders

This example describes the configurations corresponding to the ALSB 2.5 dev2dev code sample.

The structure of the sample is divided into two projects—one containing common resources, and the other containing resources for the sample producer.

Table 3-1 Projects in the WSRP Interoperability Examples 
Folder
Description
wsrp
Contains common resources that are not specific to any producer.
operationExample
Full example supports the most fine-grained monitoring. The folder contains producer-specified resources. See Monitoring Example.

 


Monitoring Example

The monitoring configuration example (in the operationExample folder) involves configuring AquaLogic Service Bus to monitor all services and operations of a producer.

The monitoring configuration uses both business services and proxy services that are based on the WSDLs defined by the WSRP standard. The example also defines the additional resources to describe the WSRP services and extend the message flows to support monitoring at the operation level. The rest of this section describes the tasks required to implement the monitoring configuration.

Step 1: Define WSDL Resources

Import all the WSRP WSDL definition files, along with the XML schema files on which the definitions depend. All the files are available as part of the sample code associated with this example, but the standard resource locations are listed in Table 3-2.

Table 3-2 WSDL Resource Definitions 
Resource Name
Location
wsrp_v1_bindings
http://www.oasis-open.org/committees/wsrp/specifications/version1/wsrp_v1_bindings.wsdl
wsrp_v1_interfaces
http://www.oasis-open.org/committees/wsrp/specifications/version1/wsrp_v1_interfaces.wsdl
wsrp_v1_types
http://www.oasis-open.org/committees/wsrp/specifications/version1/wsrp_v1_types.xsd
wlp_wsrp_v1_bindings
$BEA_HOME/weblogic81/portal/lib/wsrp/wsrp-common.jar
wlp_wsrp_v1_types
$BEA_HOME/weblogic81/portal/lib/wsrp/wsrp-common.jar
xml
http://www.w3.org/2001/xml.xsd
wsrpWSDL
http://platform:7001/producer/producer_WSDL

Producers generated by BEA Portal extend the standard WSDLs by defining an additional port that allows messages to be sent using MIME attachments. It is necessary to define these extension resources if the producer WSDL references them. In this example, an optional task is to create a resource for the WSDL used by the producer. After creating these WSDL and XML Schema resources, edit the references in each resource to resolve the dependencies on other resources.

Step 2: Create Business Services

This monitoring example uses the WSDL bindings for each port type implemented by the producer. Because a business service can be associated with only one WSDL port or binding, a separate business service resource must be created for each. A simple producer implements only the required Markup and Service Description interfaces, while a complex producer also implements the Management and Registration interfaces. The services are created identically except for the service name and types, see Table 3-3.

Table 3-3 Business Service Configuration 
Service Name
Service Type
base
WSDL port: operationExample/wsrpWSDL, port="WSRPBaseService"
desc
WSDL port: operationExample/wsrpWSDL, port="WSRPServiceDescriptionService"
mgmt
WSDL port: operationExample/wsrpWSDL, port="WSRPPortletManagementService"
reg
WSDL port: operationExample/wsrpWSDL, port="WSRPRegistrationService"
ext
WSDL port: operationExample/wsrpWSDL, port="WLP_WSRP_Ext_Service"

For each service, the required attributes are listed in Table 3-4.

Table 3-4 Service Attributes for Business Services 
Name
Value
Comments
Protocol
HTTP
Or HTTP(s) if the producer was created with secure="true".
Load Balancing Algorithm
none
Must be none, or session data will be lost across requests if multiple end points are defined.
Endpoint URI
For WebLogic Platform 8.1:
http://platform:7001/producer/producer/
The URL is the same for Markup, Service Description, Registration Service, and Portlet Management.
Endpoint URI (continued)
For WebLogic Platform 9.2 the URLs are as follows:
  • Service Description:
  • http://host*:port+/wsrpProducer/producer/wsrp_1.0/serviceDescription
Multiple endpoints must be defined for WSRP producers.
  • Markup:
http://host*:port+/wsrpProducer/producer/wsrp_1.0/markup
  • Registration:
http://host*:port+/wsrpProducer/producer/wsrp_1.0/registration
  • Portlet Management:
http://host*:port+/wsrpProducer/producer/wsrp_1.0/portletManagement
  • Markup Extension:
http://host*:port+/wsrpProducer/producer/wsrp-wlp-ext-1.0/markup
*host - Replace with the actual host name on which the application is running
+port - Replace with the actual port name on which the application is running
   

Step 3: Create the Proxy Services

Proxy services in this monitoring example are configured as follows:

To create a proxy service:

  1. Create the proxy service for the base WSRP service.
  2. As in the earlier example, create the proxy service using the existing operationExample/base business service as the model. This will automatically base the proxy service on the same WSDL binding as the business service, and it will create a message flow with an unconditional route action to the business service. For the Endpoint URI, you can use any URI, such as the producer name with the port type abbreviation appended to it (for example, /operationExampleBase).

  3. Edit the message flow to add the same transformations required to copy the request transport headers and response transport headers between the consumer and producer.
    WSRP relies on data conveyed in the transport headers to function properly. In particular, producers will return to consumers session cookies in the response headers if they expect consumers to supply session cookies in subsequent requests. Similarly, producers expect consumers to provide the requested operation in the SOAPAction request header.
  4. By default, AquaLogic Service Bus does not copy transport headers from the inbound request to the outbound request, or from the outbound response to the inbound response. The message flow must therefore propagate the required headers both in and out of the business service. Because these transformations are required for every WSRP service, it is convenient to define two common XQuery resources—one for request headers and one for response headers—that extract the correct headers.

    For request headers, use the query provided in Table 3-5

    Table 3-5 Request Header Query
    Name
    Value
    Resource Name
    wsrp/rqstHeaders
    Xquery
    declare namespace ctx="http://www.bea.com/wli/sb/context";
    declare namespace tp="http://www.bea.com/wli/sb/transports";
    declare variable $in external;
    $in/ctx:transport/ctx:request/tp:headers/child::*[local-name()!="Content-Length"]
    .

    The rqstHeaders query extracts all transport headers (except Content-Length) from the $in variable. AquaLogic Service Bus can sometimes reformat the message body so that its length no longer exactly matches the request message. Copying the length from the original request can result in transport errors if the body is modified (for example, reformatted).

    To copy the inbound request headers to the outbound business service, add the following Replace request action to the message flow:

    Replace ./ctx:transport/ctx:request/tp:headers in variable outbound with xqTransform() 
    Replace node contents 
    Variable Mapping (wsrp/rqstHeaders): 
    in: $inbound 

    Similar to the request side, the response side defines a common XQuery resource to extract all but the Content-Length header from the response returned from the producer.

    For response headers, use the following query provided in Table 3-6

    Table 3-6 Response Header Query
    Name
    Value
    Resource Name
    wsrp/rspncHeaders
    Xquery
    declare namespace ctx="http://www.bea.com/wli/sb/context";
    declare namespace tp="http://www.bea.com/wli/sb/transports";
    declare variable $out external;
    $out/ctx:transport/ctx:response/tp:headers/child::*[local-name()!="Content-Length"]
    .

    The following replace response action in the route node propagates the required headers:

    Replace ./ctx:transport/ctx:response/tp:headers in variable inbound with xqTransform() 
    Replace node contents 
    Variable Mapping (wsrp/rspncHeaders): 
    out: $outbound 
  5. Specify which operation to be invoked.
  6. Generally, in a route Action that routes to a WSDL-based service, an operation to invoke (by selecting the correct operation from the drop-down menu) is specified. However, each WSRP port implements several operations, and so the configuration requires a routing table with a case for each operation. Each case requires the same transformations to propagate the transport headers.

    Creating all of the transformations in this manner may prove to be tedious. Therefore, instead of using the drop-down menu, use another transformation to copy the operation from the proxy service to the business service. Configure this transformation by adding an Insert Action to the Request Actions of the message flow:

    Insert $inbound/ctx:service/ctx:operation as last child of ./ctx:service in variable outbound

The proxy services for the other business services can be created by repeating these steps, although a shortcut can be used to avoid recreating all of the transformations manually.

For example, to create the proxy service for the Service Description service:

  1. Create a new proxy service using the existing operationExample/base proxy service just created as the model. Following this example, use /operationExampleDesc for the Endpoint URI.
  2. On the Summary Page, click the edit link for General Configuration. The WSDL binding is created using the Base port, so correct that here to refer to the WSRPServiceDescriptionService port.
  3. Edit the message flow. The route action refers to the base business service. Correct this to route to the desc service.
Note: Use the Transport Header action to minimize low level Xquery manipulation and simplify the configuration of a proxy service. See Transport Headers section in the AquaLogic Service Bus Console Online Help for details.

Step 4: Retrieve the WSDL from the Producer

Create a service that will retrieve the WSDL from the producer and transform it to hide the actual producer endpoints. In this example the proxies for each producer have a different URI. The rest of this section describes how to create the resources to retrieve the producer WSDL.

Step 4.1: Create the Business Service to Retrieve the WSDL

Create a business service to obtain the WSDL from the producer. This resource is specific to the producer, so it must be created in the operationExample project. Table 3-7 describes the properties of the business service.

Table 3-7 Business Service Configuration Properties
Name
Value
Comments
Service Name
wsdlSvc
Any name is allowed.
Service Type
Any XML Service
Consumers usually retrieve the WSDL from the producer using an HTTP GET request. Only XML services support GET.
Protocol
HTTP or HTTP(s)
HTTP(s)
Load Balancing Algorithm
None
None preferred
Endpoint URI
http://platform:7001/producer/producer?WSDL
Although multiple endpoints may be specified for retrieving the WSDL, doing so is of limited benefit.
HTTP Request Method
GET
 

Step 4.2: Create an XQuery Expression to Construct URLs

All end point addresses in the producer's WSDL must be transformed to reflect the AquaLogic Service Bus server address and the proxy service URI values. Because each producer WSDL can have four or more ports defined, it is convenient to create an XQuery expression to simplify the construction of the endpoint locations. The XQuery expression accepts the following three string variables as input and concatenates them together to form a SOAP address element:

Table 3-8 provides the query definition in the wsrp project.

Table 3-8 XQuery Definition in the wsrp Project
Name
Value
Resource Name
wsrp/addr
XQuery
declare variable $baseURL external;
declare variable $name external;
declare variable $svc external;
declare namespace soap="http://schemas.xmlsoap.org/wsdl/soap/";
<soap:address location="{concat($baseURL, $name, $svc)}"/>

Step 4.3: Create a No-Op Proxy Service

Create a service that does nothing. To create this service, define a new proxy service in the wsrp project folder with the resource name nullSvc. Accept all of the defaults for this service. Configuring this proxy service creates a message flow for the service of an echo node.

Step 4.4: Create a Common Proxy Service to Retrieve the WSDL

Create a proxy service used by consumers to get WSDLs from producers. This proxy service is appropriate for any producer configuration modeled on this sample. The example described in this section is only a suggestion—a different approach might the specific requirements of a given implementation. Because this proxy service is not specific to a single producer, it should be created in the wsrp project folder.

The approach used in this step requires the administrator to assign each producer a name that is included in part of the URL to retrieve the WSDL. The message flow for the proxy service will extract the name from the URL, use it to locate the business service specific to that producer, obtain the WSDL, and then transform the WSDL to rewrite the endpoints to AquaLogic Service Bus. The proxy service endpoint URI is configured as /getWSDL, and the URL that consumers use to obtain a WSDL is:

http://alsb:7001/getWSDL/<producerName>

where <producerName> is the name assigned to the producer by the administrator. In this example, the producer name is operationExample.

Table 3-9 describes how the proxy service is configured:

Table 3-9 Proxy Service Configuration Properties
Property Name
Value
Comments
Service Name
producerWSDL
Any name is allowed.
Service Type
Any XML Service
 
Protocol
HTTP
 
Endpoint URI
/getWSDL
 

The message flow for this proxy service consists of a pipeline pair and a route node. The request side of the pipeline pair consists of a single stage whose job is to extract the producer name from the URL and assign it to a context variable. The action is:

Assign $inbound/ctx:transport/ctx:request/http:relative-URI to variable producerName

The response side of the message flow is a stage where all the transformations are performed. Before executing the Replace Actions to transform the WSDL, assign the base URL of the AquaLogic Service Bus server to a context variable to avoid specifying it on every transformation:

Assign "http://alsb:7001/" to variable nonSecureBaseURL

Edit the stage of the Response Pipeline to modify each Replace Action to make the transformation match the Endpoint URI given to the proxies created earlier. In this example, the proxies were created using the producer name with an abbreviated service type appended to it. The addr XQuery resource created earlier accepts an extension argument to construct the URI location. Simply change that argument to the proper value, as listed in Table 3-10.

Table 3-10 Extension Settings to Construct the URI Location 
If @binding is
svc arg of addr is
WSRP_v1_Markup_Binding_SOAP
"Base"
WSRP_v1_ServiceDescription_Binding_SOAP
"Desc"
WSRP_v1_PortletManagement_Binding_SOAP
"Mgmt"
WSRP_v1_Registration_Binding_SOAP
"Reg"
WLP_WSRP_v1_Markup_Ext_Binding_SOAP
"Ext"

You must map "name:" to "$producerName" and "BaseURL" to "$nonSecureBaseURL" similar to the "svg arg" mapping in the use table: table num_xref, Extension Settings to Construct the URI Location.

The five Replace Actions are defined as shown in the following code listing. The value of name is replaced with the binding names from the table.

Replace ./*[local-name()="definitions"]/*[local-name()="service"]/*[local-name()="port"][ends-with(attribute::binding,"name")]/*[local-name()="address"

Replace entire node

name

WSRP_v1_Markup_Binding_SOAP

WSRP_v1_ServiceDescription_Binding_SOAP

WSRP_v1_PortletManagement_Binding_SOAP

WSRP_v1_Registration_Binding_SOAP

For the first Replace Action, the following User Namespace definitions must be added as in Table 3-11:

Table 3-11 User Namespace Definitions on Replace Action
Prefix
Namespace
wsdl
http://schemas.xmlsoap.org/wsdl/
soap
http://schemas.xmlsoap.org/wsdl/soap/

The route node of this message flow consists of a routing table that selects the case based on $producerName. For each known producer, add cases so that each case routes to the correct business service to retrieve the WSDL if the name matches. This example uses the following directive:

= "operationExample" Route to wsdlSvc

  1. Add a Default Case that routes to the no-op service to handle cases in which an unknown producer name is specified:
    Default Route to nullSvc
  2. In this example, return an HTTP 404 status code by adding these response actions to the default case:

    Insert <http:http-response-code>404</http:http-response-code> as last child of ./ctx:transport/ctx:response in variable inbound

    Reply With Failure
  3. Edit the Routing Table in the route node to make the cases correspond to the producers known to the system.

Step 5: Verify the Configuration

After completing the configuration, verify it as follows:

  1. Retrieve the WSDL from a regular browser window by entering the following URL:
  2. http://alsb:7001/getWSDL/operationExample

  3. Verify that all of the end point WSRP end point URLs (except for the BEA extension service) have been changed to correctly refer to the proxy service values on the AquaLogic Service Bus server.
  4. Create a remote portlet in a Portal consumer application, specifying this URL as the address of the WSDL for the producer.
  5. Use either the WebLogic Workshop or Portal Administration Tool to create the remote portlet. Except for entering a different URL to retrieve the WSDL, the steps to create this portlet are the same as those used to create the portlet that is not proxied by AquaLogic Service Bus.

  6. After the consumer portal is complete, run the application.
  7. Enable monitoring on the AquaLogic Service Bus components that you have chosen.
  8. Use the AquaLogic Service Bus Console to drill down to see message counts and performance statistics on all WSRP services and operations handled by the producer.

  Back to Top       Previous  Next