BEA AquaLogic Service Bus Interoperability Solutions for 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, 2.5, and 3.0 (see Example Prerequisites).

This section describes a WSRP 2.0 interoperability example. For an example of WSRP 1.0 interoperability, see WSRP Interoperability Example in BEA AquaLogic Service Bus 2.6 Documentation.

This section discusses 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 that are relevant to the ALSB 3.0 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 resources specified by the producer. 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 section discusses the following topics:

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
Type
Location
xml-2.0
XML Schema
http://platform:7001/producer/producer/wsrp-2.0/markup?WSDL/xml.xsd
wsrp-2.0-types
XML Schema
http://platform:7001/producer/producer/wsrp-2.0/markup?WSDL/wsrp-2.0-types.xsd
wsrp-2.0-interfaces
WSDL
http://platform:7001/producer/producer/wsrp-2.0/markup?WSDL/wsrp-2.0-interfaces.wsdl
wsrp-2.0-bindings
WSDL
http://platform:7001/producer/producer/wsrp-2.0/markup?WSDL/wsrp-2.0-bindings.wsdl
wsrp-2.0-wsdl
WSDL
http://platform:7001/producer/producer/wsrp-2.0/markup?WSDL

Producers generated by BEA Portal extend the standard WSDLs by defining an additional port that allows messages to be sent using MIME attachments. You must 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. You must create a separate business service resource for each business service because a business service can be associated with only one WSDL port or binding. 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-2.0/wsrp-2.0-wsdl, port="WSRPBaseService"
desc
WSDL port: operationExample-2.0/wsrp-2.0-wsdl, port=" WSRPServiceDescriptionService"
mgmt
WSDL port: operationExample-2.0/wsrp-2.0-wsdl, port=" WSRPPortletManagementService
reg
WSDL port: operationExample-2.0/wsrp-2.0-wsdl, port=" WSRPRegistrationService"

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
  • Service Description:
  • http://host*:port+/producer/producer/wsrp-2.0/serviceDescription
Multiple endpoints must be defined for WSRP producers.
  • Markup:
http://host*:port+/producer/producer/wsrp-2.0.0/markup
  • Registration:
http://host*:port+/producer/producer/wsrp-2.0/registration
  • Portlet Management:
http://host*:port+/producer/producer/wsrp-2.0/portletManagement

Step 3: Create 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 model creates the proxy servicey based on the same WSDL binding as the business service, and it creates 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 return session cookies to consumers 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 propagate the required headers both in and out of the business service.

    Note: To retrieve all the headers from the transport, select Yes in the Get All Headers field of the Transport Configuration page of the ALSB proxy. For more information, see Transport Configuration Page in the Using the AquaLogic Service Bus Console.
    Note: Add Transport headers to the Request & Response actions of the Route Node in the Message Flow and enable the Pass all headers through pipeline option. For more information, see Adding Transport Header Actions in Using the AquaLogic Service Bus Console. ALSB automatically ensures that content-length is not copied.
  5. Alternatively, while configuring the routing to a business service using the AquaLogic Service Bus console, select the Use inbound operation for outbound check box when you are editing a route node to avoid low level Xquery manipulation, as in Figure 3-1.
  6. Figure 3-1 Passing an Operation from Inbound to Outbound


    Passing an Operation from Inbound to Outbound

    With this transformation, the operation for the business service is dynamically set to the same value as was specified for the proxy service. AquaLogic Service Bus counts and monitors all operations of the service.

Alternative Methods to Create Proxy Services

The proxy services for the other business services can be created by repeating these steps although you can use a shortcut 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 that is 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 modify the binding to refer to the WSRPServiceDescriptionService port.
  3. Edit the message flow. The route action refers to the base business service. Modify the route action 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.

For each service, the proxy service configurations are listed in Table 3-5.

Table 3-5 Proxy Service Configuration
Service Name
Service Type
proxyBase
WSDL port: operationExample-2.0/wsrp-2.0-wsdl, port="WSRPBaseService"
proxyDesc
WSDL port: operationExample-2.0/wsrp-2.0-wsdl, port=" WSRPServiceDescriptionService"
proxyMgmt
WSDL port: operationExample-2.0/wsrp-2.0-wsdl, port=" WSRPPortletManagementService"
proxyReg
WSDL port: operationExample-2.0/wsrp-2.0-wsdl, port=" WSRPRegistrationService"

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

Table 3-6 Required Attributes
Name
Protocol
Protocol
HTTP
Get All Headers
Yes
Endpoint URI
For WebLogic Platform 10.0/9.2 the URLs are as follows:
  • proxyBase: /operationExampleBase-2.0
  • proxyDesc: /operationExampleDesc-2.0
  • proxyReg: /operationExampleReg-2.0
  • proxyMgmt: /operationExampleMgmt-2.0

Step 4: Retrieve the WSDL from the Producer

Create a service that retrieves the WSDL specific to WSRP 2.0 from the producer and transform it to hide the actual producer endpoints. In this example, the proxies for each producer have a different URI. In addition, the section describes how to create the resources to retrieve the producer WSDL.

Step 4.1: Create the Business Service to Retrieve the WSDL Specific to WSRP 2.0

Create a business service to obtain the WSDL from the producer. This resource is specific to the producer, so you must create the resource 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 2.0
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
HTTP
Load Balancing Algorithm
None
None preferred.
Endpoint URI
http://platform:7001/producer/producer/wsrp-2.0/markup?WSDL
Although you can specify multiple endpoints for retrieving the WSDL, it has no additional use or benefit.
HTTP Request Method
GET
 

Step 4.2: Create an XQuery Expression to Construct URLs

You must transform all endpoint addresses in the producer's WSDL to reflect the AquaLogic Service Bus server address and the proxy service URI values. You must create an XQuery expression to simplify the construction of the endpoint locations because each producer WSDL can have four or more ports defined. 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 Specific to WSRP 2.0

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 is necessary based on the specific requirements of a given implementation. You must create this proxy service in the wsrp project folder because the proxy service is not specific to a single producer.

Table 3-9 describes the configuration properties for the proxy service getWSDL2.0 :

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

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_v2_Markup_Binding_SOAP
"Base"
WSRP_v2_ServiceDescription_Binding_SOAP
"Desc"
WSRP_v2_PortletManagement_Binding_SOAP
"Mgmt"
WSRP_v2_Registration_Binding_SOAP
"Reg"
WLP_WSRP_v2_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 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_v2_Markup_Binding_SOAP

WSRP_v2_ServiceDescription_Binding_SOAP

WSRP_v2_PortletManagement_Binding_SOAP

WSRP_v2_Registration_Binding_SOAP

For the first Replace Action, you must add the User Namespace definitions listed 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 4.5: Define the Message Flow of getWSDL2.0 Proxy Service to Modify WSDL to Use ALSB URLs

The message flow for getWSDL2.0 proxy service consists of a pipeline pair and a route node. To define the message flow for this proxy service, do the following:

  1. Create a Pipeline Pair
  2. Edit the request side of pipeline pair

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. To achieve this, add the Assign action as follows:

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

  1. Edit the response side of pipeline pair

The response side of the message flow is a stage where all the transformations are performed.

  1. Add the route node to the pipeline pair. 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:
  2. = "operationExample" Route to wsdlSvc-2.0

    1. Add a Default Case that routes to the no-op service to handle cases in which an unknown producer name is specified:
    2. Default Route to nullSvc

    3. In this example, return an HTTP 404 status code by adding these response actions to the default case:
    4. Insert <http:http-response-code>404</http:http-response-code> as last child of ./ctx:transport/ctx:response in variable inbound
    5. Reply With Failure

    6. Edit the Routing Table in the route node to make the cases correspond to the producers known to the system.

Step 4.6: Change the Message Flow of Proxy Service getWSDL to Enable WSRP 2.0 WSDL Retrieval Using Proxy Service getWSDL2.0

In order to consume the producer, the consumer must register the producer using its WSDL. By default, the WSDL uses WSRP version 1.0. To make consumer use WSRP version 2.0, producer WSDL with WSRP version 2.0 must be made available to the consumer. Generally, the default producer WSDL (one which uses WSRP 1.0) contains a link to the WSDL with WSRP version 2.0. This link enables consumer to use WSDL of WSRP version 2.0.

The getWSDL proxy service provides the WSDL of the producer with WSRP 1.0 version. This WSDL contains an URL of the WSDL of the same producer with version WSRP 2.0. This is the direct URL of the producer's WSDL. Instead of using the direct URL, you must the access the WSDL through ALSB using proxy service getWSDL2.0. This can be achieved in following way.

  1. Create an Xquery resource to construct the URL of WSDL, which uses WSRP 2.0
  2. Resource Name: import

    Xquery:

    declare variable $baseURL external;

    declare variable $name external;

    declare variable $svc external;

    <import location="{concat($baseURL, $svc, $name )}" namespace="urn:oasis:names:tc:wsrp:v2:wsdl" xmlns="http://schemas.xmlsoap.org/wsdl/" />

  3. Add the Replace action in the response side of message flow of getWSDL proxy service. This replace action replaces the WSDL URL in the response to the getWSDL2.0 proxy service endpoint URI. This can be done as follows:
    • Add Replace action.
    • In Xpath, specify ./*[local-name()="definitions"]/*[local-name()="import"][ends-with(attribute::location,"/producer/wsrp-2.0/markup?WSDL")]
    • In the textbox, specify variable body.
    • In Expression, select the Xquery resource import and set svc to getWSDL2.0, baseURL to $nonSecureBaseURL, and name to $producerName.
    • Select the option Replace entire node.

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 Workspace Studio 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