ALSB enables adaptive message routing between business services in an enterprise environment. Messages can be routed from a client through the ALSB intermediary, to the appropriate business service. ALSB routes messages to one or more destinations, based on the actions configured in the message processing logic. These routing actions are configured using ALSB Console. Routing provides an efficient alternative to building a multitude of static point-to-point web service connections between pairs of systems.
This section includes the following topics:
You must complete Getting Started with the ALSB Tutorials before beginning this tutorial.
The objective of this tutorial is to create and test a routing scenario using the graphical environment provided in ALSB Console. It includes the following tasks:
This tutorial introduces you to:
A primary mortgage company uses ALSB to route loan applications to appropriate business services based on the interest rate requested. An application containing a request for a rate less than 5% requires management approval and is routed to an appropriate business service for processing. All other loan applications are routed to the appropriate business service for processing.
Figure 3-1 summarizes the logical architecture to support this scenario. It illustrates how ALSB mediates the messaging between the clients and the business services in your enterprise.
A client sends a loan application to a proxy service named LoanGateway1. The default proxy service has a conditional routing stage that checks the value of the requested interest rate in the loan application document. If the interest rate is less than 5%, the loan application is routed to the ManagerLoanReview business service; otherwise it is routed to the NormalLoan business service. The target business service returns a response similar to that shown in Figure 3-42.
Note: | If the loan application is processed by the NormalLoan business service, MANAGER is replaced with NORMAL in the generated response. |
The following table lists the resources required to develop and run this tutorial.
In this tutorial, ALSB is used to route a loan application within a mortgage company to a target a web service depending on the interest rate requested. Perform the following tasks to design and configure a proxy service and the associated resources in ALSB to implement this use case scenario.
Ensure that ALSB is running in the domain that you have created for the tutorial and that you have completed the tasks described in Setting Up the Tutorials.
Using ALSB Console, you can monitor resources and configurations in ALSB environment. You can perform system monitoring without initiating a session. However, you must first create an session in the ALSB Console to update or delete resources and modify their configuration properties.
The Change Center in the console allows you to create and manage sessions. All updates to the system configuration during the current session are saved as temporary files. These changes effective only when the current session is activated. Figure 3-2 illustrates the Change Center pane available on ALSB Console.
In addition to creating and activating sessions, the Change Center allows you to perform the functions summarized in the Table 3-2.
Note: | It is recommended that you click Create before modifying any system configuration settings on the console. It is a good practice to save your configuration changes incrementally. To save and activate configuration changes in the current session, you must click Activate after you have completed making a set of changes. |
In the ALSB system environment, system configuration entities are grouped into user-defined projects. On ALSB Console, the Project Explorer page displays a default project and the various user defined projects under the Projects folder. This page allows you to perform all project configuration tasks. Each project is represented by a project folder on the console. You can add new project folders and navigate the project trees. You can collapse and expand folders as required by clicking them.
There are pre-defined resources types in the ALSB system environment. Each resource type is represented as a sub folder within the Project folder.You can create and configure resources of different types within the resource type folders.
This section describes the tasks to start a session and create a MortgageBroker project under the Projects folder. For this scenario, you will create three resource folders in the MortgageBroker project to hold each of the following pre-defined resource types:
The project explorer opens in the navigation pane and a Project page is displayed on the console.
MortgageBroker
as shown in Figure 3-3. The MortgageBroker project is created and listed in the Project Explorer under Projects.
You must create a project folder WSDL first, and add a WSDL resource to it. The WSDLs are the basis on which you create the business services and the proxy service. You subsequently create other folders and resources for this scenario.
The WSDL folder is displayed in the list of project folders for the MortgageBroker project.
ProxyService
and BusinessService
. ALSB resources are configured using configuration wizards. Each configuration wizard includes a sequence of pages that prompt you for information about the resource and provide property configuration options.
A WSDL defines the public contract (interface specification) between a client and a service, whether the service is a proxy service or a business service. It is the formal description of a web service. A WSDL is used to describe what a web service’s interface is, where it resides, and how to invoke it. You create the WSDL resource first since subsequent service registration tasks depend on it. The WSDL is subsequently used to register the business service with the proxy service.
MortgageBroker
to expand the folder, then click WSDL to open the WSDL folder. The Create a New WSDL Resource page is displayed.
BEA_HOME\alsb_3.0\samples\servicebus\examples\src\examples\webservices\jws_basic\normal\NormalLoanApprovalService.wsdl
Click Save to create the WSDL resource.
This step completes the creation of the normalLoan WSDL resource in the WSDL folder. Activate the session. For more information on how to activate a session, see Table 3-2.
Complete tasks in step 1 to step 5, to create a WSDL resource associated with the ManagerApproval Service, using the procedure in To Import a WSDL section. To import the ManagerApprovalService
WSDL resource, you must use the configuration parameters listed in the following table.
In this section, you will create a proxy service. The proxy service is used to route the loan application to the appropriate business service.
The Create a Proxy Service - General Configuration page is displayed as shown in Figure 3-7.
The Select a WSDL page is displayed. The proxy service is based on the WSDL resource that you originally created, hence you must reference the resource here.
helloPort
, which is the WSDL port for the normalLoan WSDL (helloPort).Note: | The protocol you select on this page determines the format for the endpoint URI that you will specify in the next step. The assumed default protocol is http since it is used by most services. |
The Create a Proxy Service - Operation Selection Configuration page is displayed as shown in Figure 3-12. On this page you will select the metadata accompanying the message, which identifies the web service operation to be invoked.
Note: | The default service is an RPC web service. As a result, the SOAP body contains the service operation selection information. An operation in a Java web service WSDL corresponds to a public method in the Java web service. If there are multiple public methods accessible to a client, each public method type will have an operation definition in the WSDL. For a SOAP based RPC service, the SOAP body indicates the operation (method) selected by the client. The SOAP header can also specify the operation. However, by convention, the SOAP body defines this. |
Before registering the proxy service, you can review the configuration settings and change them if necessary, by clicking Edit icon.
Note: | You must always select Save before activating a session configuration in the Change Center. |
The LoanGateway1 proxy service is displayed in the Resources pane in the ProxyService folder of the MortgageBroker project. Click the LoanGateway1 link in the Resources pane of MortgageBroker/ProxyServices to go the View a Proxy Service page.
For more information about using the ALSB Dashboard and monitoring services, see: Monitoring in Using the AquaLogic Service Bus Console and AquaLogic Service Bus Operations Guide.
This step completes the configuration of the LoanGateway1 proxy service in ALSB Console. Activate the session. For more information, see Table 3-2.
In the routing a loan scenario, when the interest rate requested on a loan application is greater than or equal to 5%, then the loan application is routed to the normal loan processing service for approval. If the interest rate requested on a loan application is less than 5%, then the loan application must be approved by a manager, therefore it is routed to a manager approval service.
The Create a Business Service - General Configuration page is displayed as shown in Figure 3-16.
The Create a Business Service - Transport Configuration page is displayed as shown in Figure 3-17.
When you specify multiple end points and a load balancing algorithm, if one end point is overloaded or not available at run time, the message can be sent to the next service in the list of end point URIs. In this case, there is only one service, therefore accepting the default behavior or selecting none does not effect the behavior of the proxy service at run time.
The host and port values specified for <host:port> represent the machine and port on which your ALSB server is running.
Note: | Delete any invalid endpoint URI in the existing URI list. |
The Create a Business Service-HTTP Transport Configuration page is displayed as shown in Figure 3-18.
The Create a Business Service-SOAP Binding Configuration page is displayed as shown in Figure 3-19.
The Create a Business Service-Summary page is displayed as shown in Figure 3-20. You can now check if all the settings of the business service have been implemented correctly.
To turn on monitoring for the NormalLoan business service, click NormalLoan business service in the Resources pane. The View a Business Service page is displayed as shown in Figure 3-21. The Operational Settings tab on this page has options to enable monitoring for the business service.
For more information about using the ALSB Dashboard and monitoring services, see Monitoring in Using the AquaLogic Service Bus Console and Monitoring ALSB at Runtime AquaLogic Service Bus Operations Guide.
You have completed the configuration of the NormalLoan business service on ALSB Console. Activate the session. For more information, see Table 3-2.
To create the business service to which a loan application is routed when the interest rate requested in that loan application is less than 5%.
Follow the same tasks as described in the preceding section: Create the NormalLoan Business Service, but use the configuration parameters in the following table.
When you complete all the tasks from Prepare the Environment to Create the Business Services, you have created two business services (NormalLoan and ManagerLoanReview), a proxy service (LoanGateway1) and two WSDLs (normalLoan and ManagerApprovalService) that are the resources required for this tutorial.
Once you have configured the proxy service with a base configuration you can proceed to the next task (Configure the LoanGateway1 Proxy Service) to complete the configuration of the proxy service by adding the routing behavior for the loan application.
ALSB Message Flows define the implementation of proxy services. Message flows can include zero or more pipeline pairs: request and response pipelines for the proxy service (or for the operations on the service) and error handler pipelines that can be defined for stages, pipelines, and proxy services. Pipelines can include one or more stages, which in turn include actions.
Note: | You must be in a session to edit resources. If you have not already done so, click Create in the change center to begin a session to configure the proxy service and edit the message flow. |
RouteNode1 is added in the configuration page as shown in Figure 3-24.
The Edit Stage Configuration: Route Node page is displayed as shown in Figure 3-25. This page contains a single Add an Action link.
Note: | A stage is an element of a pipeline and also a container for actions defined in a pipeline. Actions are the elements of a pipeline stage that define the handling of messages as they flow through a proxy service at run time. |
The Edit Stage Configuration page changes to display routing table configuration page.
You must configure the routing table to route messages to business services based on the value of the interest rate element in the incoming message. You can configure content-based routing by creating an XQuery expression, using the XQuery Expression Editor.
$body/exam:processLoanApp/loanRequest/java:Rate
Note: | The drag-and-drop functionality works only in Internet Explorer (IE) browsers. If you are using a browser other than IE, select the Rate element in the Variable Structures pane. The expression is displayed in the Property Inspector palette. Place the cursor in the XQuery expression text box and click Copy Property. The expression is copied to the text box. You can also copy the expression in the palette and paste it in the XQuery Expression text box. |
5
.The routing table now contains an expression that determines the routing behavior. If the value in the rate element is less than 5, you must route according to the routing table configuration.
You have now defined the case to route the loan application to the ManagerLoanReview business service. If the rate specified in the loan application is equal to or greater than five percent, then the message is routed to the NormalLoan business service. The next section describes how you can add a condition to the routing table to account for this case (which is the default case).
This step completes the configuration of the message flow in the route node: RouteNode1.
After you have completed these tasks, the Edit Stage Configuration page is displayed as shown in Figure 3-38.
Note: | It is a good practice to validate any updates to the routing behavior before you save the configuration. |
Configure the LoanGateway1 Proxy Service completes the configuration of the run-time message routing behavior in the LoanGateway1 Routing Table. A message is routed to the ManagerLoanReview business service if the rate specified in the loan application is less than 5. Otherwise the message is routed to the NormalLoan business service.
After you have configured ALSB to work with the client and the target business services, you can test the configuration. The routing behavior for the proxy service LoanGateway1 in this scenario is based on the interest rate requested in the loan application message. A change in the value of the interest rate results in a change in the routing behavior as follows:
<loanRequest xmlns:java="java:normal.client">
<!--Optional:-->
<java:Name>Smith</java:Name>
<!--Optional:-->
<java:SSN>1234567</java:SSN>
<!--Optional:-->
<java:Rate>4.1</java:Rate>
<!--Optional:-->
<java:Amount>9000000</java:Amount>
<!--Optional:-->
<java:NumOfYear>10</java:NumOfYear>
<!--Optional:-->
<java:Notes>Manager Loan Application Review Service</java:Notes>
</loanRequest>
The response message indicates that the proxy service LoanGateway1 routes the request to ManagerLoanReview business service because the interest rate requested is 4 (less than 5).
<loanRequest xmlns:java="java:normal.client">
<!--Optional:-->
<java:Name>Smith</java:Name>
<!--Optional:-->
<java:SSN>1234567</java:SSN>
<!--Optional:-->
<java:Rate>5.3</java:Rate>
<!--Optional:-->
<java:Amount>9000000</java:Amount>
<!--Optional:-->
<java:NumOfYear>10</java:NumOfYear>
<!--Optional:-->
<java:Notes>Manager Loan</java:Notes>
</loanRequest>
Accept other default settings and click Execute. The response as in Figure 3-42 is obtained.
The response message indicates that the proxy service LoanGateway1 routes the request to NormalLoanProcessor business service because the interest rate requested is 5.3(greater than 5).
After completing Tutorial 1. Routing a Loan Application proceed to Tutorial 2. Transforming a Loan Application.