|
Oracle Service Bus enables adaptive message routing between business services in an enterprise environment. Messages can be routed from a client through the Oracle Service Bus intermediary, to the appropriate business service. Oracle 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 Oracle 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:
You must complete Getting Started with the Oracle Service Bus Tutorials before beginning this tutorial.
The objective of this tutorial is to create and test a routing scenario using the graphical environment provided in Oracle Service Bus Console. It includes the following tasks:
This tutorial introduces you to:
A primary mortgage company uses Oracle 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 the appropriate business service for processing.
Figure 3-1 summarizes the logical architecture to support this scenario. It illustrates how Oracle 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 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-31.
| 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, Oracle 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. Perform the following tasks to design and configure a proxy service and the associated resources in Oracle Service Bus to implement this use case scenario.
Ensure that Oracle Service Bus 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 Oracle Service Bus Console, you can monitor resources and configurations in Oracle Service Bus environment. You can perform system monitoring without initiating a session. However, you must first create an session in the Oracle Service Bus 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 Oracle Service Bus 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 and enter comments for those changes. 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 Oracle Service Bus system environment, system configuration entities are grouped into user-defined projects. On Oracle 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 them.
There are pre-defined resources types in the Oracle 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 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. Oracle 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 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.
The Create a New WSDL Resource page is displayed.
BEA_HOME\osb_10.3\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 the steps in the To Import a WSDL section to create a WSDL resource associated with the ManagerApproval Service. To import the ManagerApprovalService WSDL resource, 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.
| 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. |
| 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.
The LoanGateway1 proxy service is displayed in the Resources pane in the ProxyService folder of the MortgageBroker project.
The Operational Settings tab, as shown in Figure 3-11, has options to enable monitoring for the proxy service.
For more information about using the Oracle Service Bus Dashboard and monitoring services, see: Monitoring in Using the Oracle Service Bus Console and Oracle Service Bus Operations Guide.
This step completes the configuration of the LoanGateway1 proxy service in Oracle Service Bus Console. 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-12.
The Create a Business Service - Transport Configuration page is displayed as shown in Figure 3-13.
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 Oracle Service Bus server is running.
| Note: | Delete any invalid endpoint URI in the existing URI list. |
The Create a Business Service-Summary page is displayed. 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 NormalLoan business service in the Resources pane. The View a Business Service page is displayed. The Operational Settings tab on this page has options to enable monitoring for the business service.
For more information about using the Oracle Service Bus Dashboard and monitoring services, see Monitoring in Using the Oracle Service Bus Console and Monitoring Oracle Service Bus at Runtime Oracle Service Bus Operations Guide.
You have completed the configuration of the NormalLoan business service on Oracle 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 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.
Oracle 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.
RouteNode1 is added in the configuration page as shown in Figure 3-15.
The Edit Stage Configuration: Route Node page is displayed as shown in Figure 3-16. 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. Copy the expression in the palette and paste it in 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 tasks, the Edit Stage Configuration page is displayed as shown in Figure 3-27.
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 Oracle Service Bus 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 Invocation Trace section of the test console indicates that the proxy service routed the request to ManagerLoanReview business service because the interest rate requested is 4.1 (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-31 is obtained.

The Invocation Trace section of the test console indicates that the proxy service routed the request to NormalLoan 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.
|