![]() ![]() ![]() ![]() ![]() ![]() |
AquaLogic Service Bus enables adaptive message routing between business services in an enterprise environment. Messages can be routed from a client through the AquaLogic Service Bus intermediary, to the appropriate business service. AquaLogic Service Bus routes messages to one or more destinations, based on the actions configured in the message processing logic. These routing actions are configured using the AquaLogic Service Bus 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:
The following tutorial has to be completed before beginning this tutorial:
The objective of this tutorial is to create and test a routing scenario using the graphical environment provided in AquaLogic Service Bus Console. It includes the following tasks:
This tutorial introduces you to the following features of BEA AquaLogic Service Bus:
A primary mortgage company uses AquaLogic Service Bus 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 another business service for processing. The target business service responds, indicating whether the loan application is approved or rejected.
The following figure summarizes the logical architecture to support this scenario. It illustrates how AquaLogic Service Bus 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 request 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 the following message:
Loan Application Response: APPROVED BY THE <i><b>MANAGER</b></i> LOAN APPLICATION REVIEW SERVICE.
Note: | If the loan request 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, AquaLogic Service Bus is used to route a loan application within a mortgage company to a target a Web Service depending on the interest rate requested. By performing the following steps you can design and configure a proxy service and the associated resources in AquaLogic Service Bus, to implement this use case scenario.
Ensure that AquaLogic Service Bus is running in the domain that you have created for the tutorial and that you have completed the steps described in Setting Up the Tutorials.
Using the AquaLogic Service Bus Console, you can monitor resources and configurations in the AquaLogic Service Bus environment. You can perform system monitoring without initiating a session. However, you must first create an active session in the AquaLogic Service Bus Console in order 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 come into effect only when the current session is activated. The following figure illustrates the Change Center pane available on the AquaLogic Service Bus Console.
In addition to creating and activating sessions, the Change Center also allows you to perform the following additional functions summarized in the table below.
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 AquaLogic Service Bus system environment, system configuration entities are grouped into user defined projects. On the AquaLogic Service Bus 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 on them.
There are three pre-defined resources types in the AquaLogic Service Bus 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 steps 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:
Project Explorer opens in the navigation pane and a project page is displayed on the console.
The MortgageBroker project is created and listed in Project Explorer under Projects.
You must create the WSDL folder 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.
WSDL
as displayed in the following figure. The WSDL folder is displayed in the list of project folders for the MortgageBroker project.
AquaLogic Service Bus 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 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 steps depend on it. The WSDL is subsequently used to register the business service to create the proxy service.
The Create a New WSDL Resource page is displayed.
BEA_HOME
\weblogic92\samples\servicebus\examples\src\examples\webservices\jws_basic\normal\NormalLoanApprovalService.wsdl
The resource is now displayed in the resources pane. The displayed Create a New WSDL Resource page must be similar to the page shown in the following figure.
This step completes the creation of the normalLoan WSDL resource in the WSDL folder.
You must create a WSDL resource associated with the ManagerApproval Service, using the procedure To Import a WSDL. To import the ManagerApproval Service WSDL resource, you must use the configuration parameters listed in the following table.
In this step, 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 the following figure.
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.
The Create a Proxy Service - Transport Configuration page is displayed as shown in the following figure.
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. |
/loan/gateway1
. This is the URI to which the client will send its messages.The Create a Proxy Service - HTTP Transport Configuration page is displayed as shown in the following figure.
The Create a Proxy Service - Message Level Security Configuration page is displayed as shown in the following figure.
You do not need to configure custom authentication settings on this page since a security policy has not been defined for the Web Service.
The Create a Proxy Service - Operation Selection Configuration page is displayed as shown in the following figure. 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. |
The Create a Proxy Service - Summary page is displayed as shown in the following figure. This page shows a summary of configuration settings for the proxy service.
Before registering the proxy service, you can review the configuration settings and change them if necessary, by clicking Edit.
Note: | You must always select Save prior to 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.
The View a Proxy Service page is displayed as shown in following figure. The Operational Settings tab on this page has options to enable monitoring for the proxy service.
For more information about using the AquaLogic Service Bus Dashboard and monitoring services, see:
- Monitoring in
AquaLogic Service Bus Console Online Help
- Monitoring in
BEA AquaLogic Service Bus Operations Guide
This step completes the configuration of the LoanGateway1 proxy service in the AquaLogic Service Bus Console.
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.
Note: | If the folders are not displayed in the project tree, click Activate, then Submit to register the changes in the session. The folders that you created for the MortgageBroker project are displayed. Click Create to start a session and make changes to the system configuration. |
The Create a Business Service - General Configuration page is displayed as shown in the following figure.
NormalLoan
.The Create a Business Service - Transport Configuration page is displayed as shown in the following figure.
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 dispatched 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.
http://
<host:port>
/njws_basic_ejb/NormalSimpleBean
The host and port values specified for <host:port>
represent the machine and port on which your AquaLogic Service Bus server is running. They must be the same as the values specified in the following properties file: BEA_HOME\weblogic92\samples\servicebus\examples\src\examples.properties
For more information, see Configure the examples.properties File.
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 the following figure.
The Create a Business Service-SOAP Binding Configuration page is displayed as shown in the following figure.
The Create a Business Service-Summary page is displayed as shown in the following figure. 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 the name of the business service—NormalLoan in Resources pane. The View a Business Service page for NormalLoan business service is displayed as shown in the following figure. The Operational Settings tab on this page has options to enable monitoring for the business service.
For more information about using the AquaLogic Service Bus Dashboard and monitoring services, see:
- Monitoring in
AquaLogic Service Bus Console Online Help
- Monitoring in BEA AquaLogic Service Operations Guide
You have completed the configuration of the NormalLoan business service on AquaLogic Service Bus Console.
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 steps as described in the preceding section: Create the NormalLoan Business Service, but use the configuration parameters in the following table.
When you complete Step 1: Prepare the Environment to Step 5: Create the Business Services, you have created two business services (NormalLoan
and ManagerLoanReview
), a proxy service (LoanGateway1
) and a WSDL (normalLoan
) that are the resources required for the tutorial.
Once you have configured the proxy service with a base configuration you can proceed to the next step (Step 6: Configure the LoanGateway1 Proxy Service) to complete the configuration of the proxy service by adding the routing behavior for the loan application.
AquaLogic Service Bus 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. To configure the routing behavior of the LoanGateway1 proxy service, you must complete the following for the message flow:
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 the following figure.
The Edit Stage Configuration: Route Node page is displayed as illustrated in Figure 3-27. 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 into the XQuery Expression text box. |
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 steps, the Edit Stage Configuration page is displayed as shown in the following figure.
Note: | It is a good practice to validate any updates to the routing behavior before you save the configuration. |
Step 6: 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.
Now that you have configured AquaLogic Service Bus to work with the client and the target business services, you can test the configuration. The routing behavior for the proxy service 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:
This section describes how you can test the proxy service for both cases. Testing is done from the command line by changing the value of the interest rate field in the build.xml
file and then running ant
. The message returned in the command window after running a test indicates the success or failure of the test and identifies the business service that processed the request.
This section includes the following test scenarios:
Caution: | To run this test correctly, ensure that WebLogic Server is started in the AquaLogic Service Bus 2.6 (ServiceBusTutorial) domain. |
setEnv.cmd
to set up your environment as follows: BEA_HOME
\weblogic92\samples\servicebus\examples\src\examples\webservices\jws_basic\normal
build.xml
file run target as follows:build.xml
. build.xml
file looking for the string:<arg line="http://$...
<arg line="http://${wls.hostname}:${wls.port}/loan/gateway1 steve 555 2500 20 4.9 notes" />
This changes the URI to that of the proxy service running in the tutorial domain, and specifies a value of 4.9
as the interest rate.
All the input parameters specified on the arg line
are described in the following table
ant
run
This tests the routing logic of the proxy service. A response message from the Web Service is displayed at the command prompt.
[java] Loan Application Response: APPROVED BY THE <i><b>MANAGER</b></i> LOAN APPLICATION REVIEW SERVICE
[java] Rate: 4.9
BUILD SUCCESSFUL
The response message indicates that the ManagerLoanReview business service processed the request because the interest rate requested was 4.9 (less than 5).
build.xml
file in the following directory:BEA_HOME
\weblogic92\samples\servicebus\examples\src\examples\webservices\jws_basic\normal
Note: | Enter 5.1 as the interest rate in the build.xml file (to test the NormalLoan business service), and then save the changes. |
ant run
A response message from the Web Service is displayed at the command prompt.
java] Loan Application Response: APPROVED BY THE <i><b>NORMAL</i></b> LOAN APPLICATION PROCESSING SERVICE
java] Rate: 5.1
BUILD SUCCESSFUL
The response message indicates that the Normal Loan business service processed the request because the interest rate requested was 5.1.
![]() ![]() ![]() |