Tutorials
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
BEA AquaLogic Service Bus enables message routing between business services in the enterprise environment. Messages can be routed from a client through the AquaLogic Service Bus intermediary, to the appropriate business service. BEA AquaLogic Service Bus routes messages to one or more destinations based on the actions taken on the messages. You configure those actions using the AquaLogic Service Bus Console. Routing provides an efficient alternative to building a multitude of point to point Web services connections between pairs of systems.
This section includes the following topics:
Complete Setting Up the Tutorials.
The goal of the tutorial is to provide the steps to create and test a routing scenario developed using the graphical environment provided in AquaLogic Service Bus Console. It includes the following:
Developing this tutorial exposes you to the following features of BEA AquaLogic Service Bus:
A primary mortgage company uses BEA 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 where BEA AquaLogic Service Bus fits in your enterprise to mediate the messaging between the clients and the business services for the routing scenario.
Figure 4-1 Expose a Loan Application Request Web Service via AquaLogic Service Bus
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 less than 5% the loan request is routed to the managerLoanReviewService business service, otherwise it is routed to the NormalLoan business service. The target business service returns a response message similar to the following message:
"Congratulations, your loan is approved and your loan ID is <loanID>. In future communications about your loan please reference this Loan ID for faster service
".
The following table lists the resources required to develop and run the Routing a Loan Application tutorial.
Table 4-1 Routing Loan Application Tutorial Resources
This is an external business service used by AquaLogic Service Bus |
|
This is an external business service used by AquaLogic Service Bus |
|
In this tutorial, BEA AquaLogic Service Bus is used to route a loan application within a Mortgage company to a target Web service depending on the interest rate requested.
Complete the following steps to design and configure the proxy service and the associated resources in AquaLogic Service Bus to resolve this user case scenario:
Ensure that AquaLogic Service Bus is running in the domain you created for the tutorial and that you have completed the steps described in Setting Up the Tutorials.
You must first start a session in the AquaLogic Service Bus Console. You can view resources and configurations in the AquaLogic Service Bus Console without being in a session, but to edit, change, or delete items or properties in a project, you must be in an active session. The Change Center manages sessions in the console. Sessions are saved as temporary files until the session is activated.
The following table provides a summary of the Change Center functionality.
Table 4-2 Description of the Change Center
Note: It is good practice to save your configuration changes incrementally.
It is recommended that whenever you change a configuration in the console that you click Create before making any changes and that you click Activate when you have completed your changes to the configuration.
This section describes how to create a MortgageBroker project under the Projects folder in the AquaLogic Service Bus Console. For this scenario, you will also create three folders in the MortgageBroker project—to hold each of the resource types to be defined for the project:
Note: In the AquaLogic Service Bus Console, you can add new projects and navigate the project trees using the Project Explorer. Project folders can be collapsed and expanded as necessary. All project configurations are performed in the project page. Selecting a project or one of its sub-folders from the Project Explorer displays the information for that entity on the project page.
You will 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.
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.
The 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 as subsequent service registration steps depend on it. The WSDL is subsequently used to register the business service to create the proxy service.
Import the WSDL associated with the ManagerApproval Service. Use the procedure To Import a WSDL to do this using the following parameters.
Table 4-3 ManagerApproval Service WSDL
|
In this step you will create a proxy service. The proxy service is used to route loan application to the appropriate business service.
The WSDL Browser window is displayed. The proxy service is based on the WSDL resource you originally created, hence you must reference the resource here.
Note that the protocol you select on this page determines the format for the Endpoint URI that you will specify in the next step. HTTP is the default protocol as it is the assumed protocol of most services.
The Edit a Proxy Service - HTTP Transport Configuration page is displayed. Because a security policy has not been defined for the Web service, you do not need to change configuration settings on this page.
On this page you are selecting the metadata accompanying the message that identifies which Web service operation to invoke.
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 more than one method is accessible to a client (that is, there are multiple public methods) then 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. Note that the SOAP header can also specify the operation—by convention however, the SOAP body does do.
A summary of the configuration settings for the proxy service is displayed. You can review the configuration settings and change them if necessary before registering the proxy service.
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 panel in the MortgageBroker project, ProxyService folder.
The Monitoring Configuration page, which you can use to enable monitoring for this service, is displayed. To enable monitoring:
For more information about using the AquaLogic Service Bus Dashboard and monitoring services, see:
- Monitoring in the AquaLogic Service Bus Console Online Help and
- Monitoring in the BEA AquaLogic Service Bus User Guide.
For this 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 manger and is therefore routed to a manager approval service.
In this step, you will define the normal loan processing and manager approval business services:
Note: If the folders are not displayed in the project tree, click Activate to register the changes in the session. The folders you created for the MortgageBroker project are displayed. Click Edit to make changes to the session.
none
because load balancing is relevant only when a service specifies multiple end points.In the case that multiple endpoints and a load balancing algorithm are specified, if one endpoint is overloaded or not available at run time, the message can be dispatched to the next service in the list of endpoint 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
where host:port
represents the machine and port on which your AquaLogic Service Bus server is running. The Endpoint URI of the business service is the endpoint URI on the server on which the service is deployed.
The Edit a Business Service—Summary page is displayed. You can now review the business service to check that you implemented it correctly.
The Monitoring Configuration page, which you can use to enable monitoring for this service, is displayed. To enable monitoring:
For more information about using the AquaLogic Service Bus Dashboard and monitoring services, see:
- Monitoring in the AquaLogic Service Bus Console Online Help and
- Monitoring in the BEA AquaLogic Service Bus User Guide.
This section describes how to create the business service to which a loan application is routed in the case that the interest rate requested in that loan application is less than 5%.
Follow the same steps as described in the preceding section: To Create the Normal Loan Business Service, but use the configuration parameters in the following table.
Table 4-4 ManagerLoanReviewService Business Service
Select the managerApproval WSDL you created based on: |
|
By completing Step 1: Prepare Your Environment to Step 5: Create the Business Services, you created two business services (NormalLoan
and managerLoanReviewService
), a proxy service (LoanGateway1
) and a WSDL (normalLoan
) as resources required for the tutorial scenario.
You configured the proxy service with a base configuration. The next step (Step 6: Configure the LoanGateway1 Proxy Service) describes how to complete the configuration of the proxy service to add 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 will complete the following for the message flow:
The Project Explorer pane is opened in the navigation panel and the Summary of proxy Services project page is displayed in the console.
Note: You must be in a session to edit resources. If you have not already done so, begin a session (click Create in the Change Center) so that you can configure the proxy service and edit the message flow.
The Edit Message Flow page for the proxy service LoanGateway1 is displayed. This page displays the default message flow configuration. The default configuration consists of a Start node and an Echo node. This is the minimum configuration of a message flow.
The Edit Stage Configuration page is displayed. The page contains a single link, Add an Action.
A stage is an element of a pipeline and it is 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 will configure the routing table to route messages to business services based on evaluating the interest rate element of the incoming message. You must create an XQuery expression to do this. You can do so using the XQuery Expression Editor.
body
.A graphical representation of the structure of the loan request document is displayed. At run time, the proxy service makes its routing decision based on the value in the rate
element of the message—therefore you select this element to use in the expression.
Rate
node element, drag and drop it in the Edit the Expression text box. The XQuery expression is written in the text box.Note: The drag and drop functionality works only in Internet Explorer (IE) browsers. If you are using a browser other than IE, follow step a and step b. The expression is displayed in the XPath text box in the Message Context Variables palette. Instead of dragging and dropping the Rate
node onto the Edit Expression text box, simply copy the expression from the XPath text box and paste it into the Edit Expression text box.
It is good practice to do this before you submit the expression. The expression is validated for syntax. If there are errors in the expression, they are displayed directly above the Validate button. In this case the expression is valid.
You are returned to the routing table on the Edit a Stage Configuration page. <Expression>
is replaced by the expression that returns the value of the rate
element in the message.
The routing table now contains an expression that determines the routing behavior: If the value in the rate element is less than 5 then route according to the routing table configuration.
You have now defined the case for routing the loan application to the managerLoanReviewService
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 to add a condition to the routing table to account for this case (the default case).
By completing Step 6: Configure the LoanGateway1 Proxy Service, you have completed the configuration of the logic in the Routing Table that determines the run-time routing behavior for messages. A message is routed to the managerLoanReviewService
business service if the rate specified in the loan application is less than five, otherwise the message is routed to the normalLoan
business service.
Now that you have configured BEA AquaLogic Service Bus to work with the client and the target business services, you can test the configuration. Testing is done on the command line by changing the value of the interest rate field in the build.xml
file and then running ant
. The routing behavior for the proxy service in this scenario is based on the interest rate requested in the loan application message. Changing the value of the interest rate changes the routing behavior:
managerLoanReviewService
business service.normalLoan
service.This section describes how to test the proxy service for both cases. 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:
To run this test correctly, ensure that WebLogic Server is started in the BEA AquaLogic Service Bus (ServiceBusTutorial) domain.
BEA_HOME
\weblogic90\samples\servicebus\examples\src\
setEnv.cmd
Note: If you are testing the configuration on a UNIX system, run the setEnv.sh
script at your command line prompt.
BEA_HOME
\weblogic90\samples\servicebus\examples\src\examples\webservices\jws_basic\normal
build.xml
file run target:
<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
for the interest rate.
The remainder of the input parameters specified on the arg line
are described in the following table.
ant
run
Note that the response message indicates that the Manager Loan Application Processing Service processed the request because the interest rate requested was 4.9 (less than 5.0).
build.xml
file in the following directory:
BEA_HOME
\weblogic90\samples\servicebus\examples\src\examples\webservices\jws_basic\normal
Note: In this case (to test the normalLoan
business service), enter a value of 5.1 for the interest rate in the build.xml
file (see Table 4-5), then save the changes.
ant run
Note that the response message indicates that the Normal Loan Application Processing Service processed the request because the interest rate requested was 5.1.
![]() ![]() |
![]() |
![]() |