Tutorials

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Tutorial 2. Transforming a Loan Application

Data transformation is the mapping of data from one format to another, to make information compatible in heterogeneous system environments. ALSB can be configured to route and transforms messages when necessary, based on specific proxy service configurations.

This section includes the following topics:

 


Prerequisites

You must complete Tutorial 1. Routing a Loan Application before beginning this tutorial.

 


Tutorial Objectives

This tutorial provides the tasks to create and test a routing and transformation scenario developed using the graphical environment provided in ALSB Console. Using the ALSB Console you will build on what you learned in Tutorial 1. Routing a Loan Application to perform the following tasks:

 


Definition of the Scenario

A primary mortgage company uses ALSB to identify and re-route loan applications that can be sold to secondary loan companies. Loan applications with a principal request of greater than US $25 million are candidates for sale to a secondary loan company. When ALSB receives a loan application meeting these criteria, the applicant’s credit rating information is retrieved (by making a callout to a web service). The credit rating information is added to the loan application. The application is then forwarded to the secondary mortgage company web service to be processed. Loan applications with a principal request equal to or less than US $25 million are routed to a different business service for processing. The target business services respond indicating whether the loan application is approved or rejected.

Figure 4-1 illustrates where ALSB fits in your enterprise to mediate the messaging between the enterprise services and the business services.

Figure 4-1 Expose a Loan Application Processing Web Service via ALSB

Expose a Loan Application Processing Web Service via ALSB

Overview of the Run-time Process in ALSB

A primary mortgage company receives a loan application. It is routed through the ALSB proxy service, LoanGateway2, to determine the target business service to process the application. If the loan amount is greater than US $25 million, the application is routed to the LoanSaleProcessor business service. If the amount is less than or equal to US $25 million, the application is routed to the NormalLoan business service. When the loan amount is more than US $25 million, the request pipeline makes a service callout to the CreditRating business service and receives the credit rating of the applicant using the $creditRating variable. To fulfill the interface requirements of the secondary loan company service, the message body is transformed by adding the credit rating details. The transformed message ($body) is routed to a business service that handles applications for large loan amounts. The service returns a response similar to the following:

Loan Application Response: CREDIT RATING: AA: LOAN PURCHASED BY THE <i><b>LARGE</b></i> LOANS SERVICE

Required Resources

You will use the MortgageBroker project folder and the directory structure you created in the previous tutorial to hold the project artifacts. The resources required for this scenario are described in the following table.

Table 4-1 Routing a Loan Application Tutorial Resources
Resource Name
Description
creditRating, loanSale
These are the WSDL resources.
NormalLoan, LoanSaleProcessor, CreditRating
These are the external business services used by ALSB.
LoanGateway2
This is the ALSB proxy service.

 


Tasks in This Tutorial

In this tutorial, you will perform the following tasks:

Prepare the Environment

Ensure that ALSB is running in the domain that you created for the tutorial and that you have completed the tasks described in Tutorial 1. Routing a Loan Application.

Create a Session

For this tutorial, you need to use the MortgageBroker project folder, and the directory structure that you created in Tutorial 1. Routing a Loan Application to hold the project artifacts.

  1. In the ALSB console Change Center click Create to create a new session.
  2. In the ALSB Console navigation pane, select the Project Explorer.
  3. The project explorer pane is opened in the navigation pane and a project page is displayed in the console.

  4. In the project explorer, expand the MortgageBroker project tree to expose the subfolders containing the project artifacts:
    • ProxyService
    • BusinessService
    • WSDL

Create the Resources

In this section , you will learn how to import the WSDL resource, and create the proxy service and the business services required for the tutorial.

Create the WSDL Resources

You must create the WSDL resources (loanSale and creditRating) before creating the other resources required for this scenario. WSDL resources are the building blocks for creating the business and proxy services. To import the appropriate WSDLs and create the WSDL resources, follow the tasks described in To Create the normalLoan WSDL Resource section in Tutorial 1. Routing a Loan Application. However, for this instance, name your resources and base them on the WSDLs listed in the following table.

Table 4-2 WSDL Configuration Settings
Resource Name
Location of the WSDL
loanSale
BEA_HOME\alsb_3.0\samples\servicebus\examples\src\examples\webservices\jws_basic\large\LargeLoanPurchasingService.wsdl
creditRating

BEA_HOME\alsb_3.0\samples\servicebus\examples\src\examples\webservices\jws_basic\credit\CreditLoanApprovalService.wsdl

When you complete this task, the MortgageBroker/WSDL folder contains the WSDL resources created in this tutorial and in Tutorial 1. Routing a Loan Application as shown in Figure 4-2.

Figure 4-2 WSDL Resources

WSDL Resources

Create a Proxy Service

In this task, you will create a proxy service. The proxy service is used to route the loan application to the appropriate business service. It also calls a look up service to obtain the credit rating of the requestor if the loan amount requested is greater than US $25 million.

Note: No units are assigned to the loan amount, but units can be any currency such as US dollars.

To create a new proxy service, follow the tasks described in To Create the Proxy Service. For this instance, use the proxy service name and the endpoint URI listed in the following table.

Table 4-3 LoanGateway2 Proxy Service Configuration Settings
Proxy Service Name
LoanGateway2
Service Type
Select the WSDL web service (port or binding) option.
Select the normalLoan WSDL in the Select a WSDL page.
Select the helloPort port in the Select a WSDL Definition page.
Endpoint URI
Click Next to proceed to the Create a Proxy Service - Transport Configuration page.
Enter /loan/gateway2 as the endpoint URI.

After you complete this task, a summary of the configuration settings for the proxy service is displayed as shown in Figure 4-3. You must review the configuration settings before to registering the proxy service.

Figure 4-3 LoadGateway2 Proxy Service - Configuration Settings Summary

LoadGateway2 Proxy Service - Configuration Settings Summary

When you complete this task, the MortgageBroker/ProxyService folder contains the proxy services that you created in this tutorial and in Tutorial 1. Routing a Loan Application as shown in Figure 4-4.

Figure 4-4 Proxy Service Resources

Proxy Service Resources

Create a Business Service

In this scenario, the proxy service is configured to route to one of several different business services, depending on the business requirements as follows:

You created the NormalLoan service in Tutorial 1. Routing a Loan Application. To create the LoanSaleProcessor and CreditRatingService business services for this scenario, follow the tasks described in Create the NormalLoan Business Service. You must configure your services using the names, service types, and endpoint URIs listed in the following two tables.

Table 4-4 Configuration Settings for the LoanSaleProcessor Business Service
Business Service Name
LoanSaleProcessor
Service Type
Select the WSDL web service as the Service Type option.
Select the LoanSale WSDL in the Select a WSDL page.
Select the helloPort port in the Select a WSDL Definition page.
Endpoint URI
Ensure that the pre-populated value for the Endpoint URI in the Existing URIs field is http://<host:port>/ljws_basic_ejb/LargeSimpleBean where <host:port> represents the machine and port on which the ALSB server is running.
Load Balancing Algorithm
none

Table 4-5 Configuration Settings for the CreditRating Business Service
Business Service Name
CreditRating
Service Type
Select the WSDL port option.
Select the creditRating WSDL in the Select a WSDL page.
Select the helloPort port in the Select a WSDL Definition page.
Endpoint URI
Ensure that the pre-populated value for the endpoint URI in the Existing URIs field is http://<host:port>/crejws_basic_ejb/CreditSimpleBean
where <host:port> represents the machine and port on which your ALSB server is running.
Load Balancing Algorithm
none

When you complete this task, the MortgageBroker/BusinessService folder contains the business services that you created in this tutorial and in Tutorial 1. Routing a Loan Application as shown in Figure 4-5.

Figure 4-5 Business Service Resources

Business Service Resources

Summary

Upon completing all the tasks from Prepare the Environment to Create the Resources you have created the resources required for this scenario. You have also configured the proxy service with a base configuration. In the following three tasks you will configure the proxy service by adding the routing, transformation, and Service Callout behavior for the loan application messages.

Configure Routing for LoanGateway2 Proxy Service

A proxy service is implemented in ALSB as a message flow, which includes request and response pipelines. This task includes the following tasks:

Create a Routing Table

  1. In the ALSB Console navigation pane, select Resource Browser.
  2. The Resource Browser pane is opened in the navigation pane and the Summary of Proxy Services page is displayed in the console.

    Note: You must be in an session to edit resources.
  3. In the Actions column associated with the LoanGateway2 proxy service, click the Edit Message Flow icon.
  4. Figure 4-6 Edit Message Flow -LoanGateway2


    Edit Message Flow -LoanGateway2

  5. Click LoanGateway2, then select Add Route from the short-cut menu. In the configuration dialog, RouteNode1 is added.
  6. Figure 4-7 Edit Message Flow - LoanGateway2 RouteNode1


    Edit Message Flow - LoanGateway2 RouteNode1

  7. Click RouteNode1 and select Edit Route from the short-cut menu. The Edit Stage Configuration page is displayed and contains a single link, Add an Action.
  8. Figure 4-8 Add an Action Link


    Add an Action Link

  9. Click Add an Action, then select CommunucationArrow symbol Routing Table from the short-cut menu.
  10. Figure 4-9 Add a Routing Table Element


    Add a Routing Table Element

    The Edit Stage Configuration page changes to display the routing table configuration information.

    Figure 4-10 Routing Table Configuration Page


    Routing Table Configuration Page

    To configure the routing table to route messages to business services based on the amount element of the incoming message, you must create an XQuery expression using the XQuery Expression Editor.

Configure the Routing Expression

  1. In the Routing Table, click the <Expression> link. The XQuery Expression Editor is displayed.
  2. Figure 4-11 XQuery Expression Editor


    XQuery Expression Editor

  3. Accept the default selection of XQuery Text in the editor.
  4. In the Namespace Definitions pane, click Variable Structures.
  5. Figure 4-12 Namespace Definitions Pane

    Namespace Definitions Pane

  6. Click Variable Structures to display the Variable Structures pane. Select body from the Select Structure drop-down list in the Variable Structures pane.
  7. Figure 4-13 Variable Structures Pane


    Variable Structures Pane

  8. A structural representation of the body element is displayed in the Variable Structures pane. Click + to expand the processLoanApp element, within the $body - processLoanApp (request) element.
  9. Click + to expand the loanRequest application element. A graphical representation of the structure of the loan application document is displayed. At run time, the proxy service makes its routing decision based on the value in the amount element of the message.
  10. Figure 4-14 loanRequest Element


    loanRequest Element

  11. Click the Node icon associated with the Amount node element, drag-and-drop it in the XQuery Expression text box. The following XQuery expression is written in the text box.
  12. $body/exam:processLoanApp/loanRequest/java:Amount 
Note: The drag-and-drop functionality works only in Internet Explorer (IE) browsers. If you are using a browser other than IE, select the Amount 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.
  1. Click Validate to validate the XQuery.
  2. 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 as shown in Figure 4-15.

    Figure 4-15 Validate Routing Expression


    Validate Routing Expression

  3. Click Save.
  4. The routing table is displayed on the Edit Stage Configuration page. <Expression> is now replaced by the expression that returns the value of the amount element in the message.

  5. In the Operator drop-down list, select > and in the associated text field, enter the number 25000000 (without commas).
  6. The routing table now contains an expression that determines the routing behavior. If the value in the Amount field is greater than US $25 million, then messages are routed according to the routing table configuration.

  7. Click the Service link to define the service to which you want to route when the amount is greater than US $25 million. The Select Service page is displayed.
    1. Select the LoanSaleProcessor business service
    2. Click Submit.
  8. In the Operation drop-down list, select the processLoanApp operation.
  9. This is the operation on the LoanSaleProcessor business service that is invoked at run-time if the amount of the loan requested in the loan application is greater than US $25 million.

You have now defined the case for routing the loan application to the LoanSaleProcessor business service as shown in Figure 4-16.

Figure 4-16 Routing the Loan Application to LoanSaleProcessor

Routing the Loan Application to LoanSaleProcessor

When a loan application with a loan amount greater than US $25 million is identified, a web service callout (Service Callout) is performed to retrieve the customer's credit rating. The credit rating information is added to the loan application. The application is then forwarded to the secondary mortgage company's business service to be processed.

Configure Routing Request Actions for LoanGateway2 Proxy Service

This section describes how to configure the proxy service to do the Service Callout and transform the message appropriately for the target service.

Configure the Service Callout Input Parameter

A Service Callout is used to send the loan application to the CreditRating business service, which returns the credit rating of an applicant. Before adding the Service Callout action, you must configure the Service Callout input parameter by performing the following tasks:

Add a Delete Action

You must delete the “xsi:type” attribute from the message by adding and configuring a Delete action as follows:

  1. In the Routing Table Request Actions pane, select Add an ActionArrow symbolMessage ProcessingArrow symbolDelete.
  2. Figure 4-17 Add a Delete Action


    Add a Delete Action

    The Delete action is added to the Routing Table Request Action pipeline.

    Figure 4-18 Initial Delete Action


    Initial Delete Action

  3. Select the <XPath> in variable option, then click <XPath>. The XPath Expression editor is displayed.
    1. In the XPath Expression text box, enter the following expression:
    2. ./exam:processLoanApp/loanRequest/@xsi:type 
    3. Click Validate, then Save. You will return to the Edit Stage Configuration page.
  4. Enter body in the variable text field of the <XPath> in variable option in the Delete action.
  5. The configuration for the Delete action is therefore:

    Delete ./exam:processLoanApp/loanRequest/@xsi:type in variable body as shown in Figure 4-19.

    Figure 4-19 LoanGateway2 Routing Request Delete Action


    LoanGateway2 Routing Request Delete Action

Assign a Service Callout Input Parameter

You must now assign an input parameter for the service callout action as follows:

  1. Click on the Delete icon in the Request Actions pane of the Routing Table.
  2. Select Add an Action. Then select Message Processing Arrow symbolAssign.
  3. The Assign action is added to the Request Action pipeline in the Routing Table.

    Figure 4-20 Initial Assign Action


    Initial Assign Action

  4. Click the <Expression> link. The XQuery Expression editor is displayed.
  5. Accept the default selection of XQuery Text in the editor.
  6. Navigate to the Variables Structures pane. Select body from the Variables Structures drop-down list.
  7. Expand the element list. Drag-and-drop the loanRequest element into the XQuery expression text box. The following XQuery expression is written in the text box:
  8. $body/exam:processLoanApp/loanRequest
  9. Click Validate to validate the XQuery, then Save. The routing table is displayed on the Edit Stage Configuration page. <Expression> is now replaced by the expression that returns the content of the message to be sent to the Service Callout service.
  10. Enter loanRequestVariable in the variable text box as shown in Figure 4-21.
  11. Figure 4-21 LoanGateway2 Routing Request Assign Action


    LoanGateway2 Routing Request Assign Action

This task completes the assignment of value returned by the XQuery expression ($body/exam:processLoanApp/loanRequest) to the loanRequestVariable variable.

Rename Input Variable Namespace

You must now rename the namespace of the input parameter you have assigned for the Service Callout using the tasks below:

  1. Click the Assign icon in the Request Actions pane of the Routing Table.
  2. Select Add an Action > Message Processing > Rename. The Rename action configuration fields are added to the Request Actions pane.
  3. Figure 4-22 Initial Input Variable Rename Action


    Initial Input Variable Rename Action

  4. In the Rename statement, click the <XPath> link. The XPath Expression Editor is displayed.
  5. In the XPath Expression text box, enter the following XPath expression:
  6. .//java:*

    This expression identifies every instance of a namespace with a prefix of java.

  7. Click Save to save the XPath expression and return to the Edit Stage Configuration page.
  8. In the variable text box, enter loanRequestVariable.
  9. You have completed creating a condition in which the XPath expression finds all the namespaces with the java prefix in the loanRequestVariable context variable. The next task specifies the namespace to replace the namespaces identified by the XPath expression.

  10. Select the namespace option and enter the fully qualified new namespace to be substituted in the message. The new namespace is java:credit.client.
  11. Note: The default namespace that you are replacing in this case is java:normal.client.

    The Rename action is displayed as shown in Figure 4-23.

    Figure 4-23 LoanGateway2 Routing Request Rename Action


    LoanGateway2 Routing Request Rename Action

Add a Service Callout Action

This section describes how you can configure the Service Callout action to send the loan application to the CreditRating business service, that returns the credit rating of an applicant.

  1. In the Request Actions pane of the Routing Table, click the Rename icon.
  2. Select Add an ActionArrow symbolCommunicationArrow symbolService Callout.
  3. The Service Callout action is added to the Request Action pipeline in the Routing Table.

    Figure 4-24 Initial Service Callout Action


    Initial Service Callout Action

  4. Click the Service Callout to <Service> link. The Select Service page is displayed.
    1. In the Select Service page, select CreditRating.
    2. Click Submit.
    3. The service callout action will be displayed as shown in Figure 4-25.

      Figure 4-25 Service Callout Action with Configured Service


      Service Callout Action with Configured Service

  5. From the Operation drop-down list, select processLoanApp. The fields that allow you to configure the request and response parameters for the service callout are displayed as shown in Figure 4-26.
  6. Figure 4-26 Service Callout Action - Configured Operation


    Service Callout Action - Configured Operation

    1. In the service callout Request Parameters section, set the loanRequest parameter to loanRequestVariable (the message context variable you defined in the preceding section).
    2. In the service callout Response Parameters section, set the return parameter name to creditRating as shown in Figure 4-27.
    3. Figure 4-27 Service Callout Action - Configured Parameters


      Service Callout Action - Configured Parameters

This task completes the service callout configuration to invoke the creditRating web service. The credit rating returned by this web service is assigned to the $creditRating context variable.

Configure Message Transformation

In this section, you will configure the message transformation to match the public contract (interface requirements) of the LoanSaleProcessor business service. You will configure the proxy service to:

Rename the Message Namespace
  1. Click the Service Callout icon and select Add an ActionArrow symbolMessage ProcessingArrow symbolRename. The Rename action configuration fields are added to the Request Actions pane.
  2. In the Rename statement, click the <XPath> link. The XPath Expression Editor is displayed.
  3. In the XPath Expression text box, enter the following XPath expression:
  4. .//java:*

    This expression identifies every instance of a namespace with a prefix of java.

  5. Click Save to save the XPath expression and return to the Edit Stage Configuration page.
  6. In the variable text box, enter body. The body context variable contains the body of the message.
  7. You have completed creating a condition in which the XPath expression finds all the namespaces with the java prefix in the body context variable. The next task specifies the namespace to replace the namespaces identified by the XPath expression.

  8. Select the namespace option and enter the fully qualified new namespace to be substituted in the message. The new namespace you must enter is java:large.client.
  9. Note: The default namespace that you are replacing in this case is java:normal.client.

    The Rename action is displayed as shown in Figure 4-28.

    Figure 4-28 Message Namespace Rename Action


    Message Namespace Rename Action

Insert a New Element in the Message
  1. Click the Rename icon and select Add an ActionArrow symbolMessage ProcessingArrow symbolInsert.
  2. The Insert action configuration fields are added to the Request Actions pane.

  3. In the Insert action, click <Expression>. The XQuery Expression editor is displayed. You will add a new namespace on this page in the subsequent tasks.
  4. In the Namespace Definitions palette, navigate to the User Defined Namespaces area.
    1. Click Add Namespace.
    2. In the Prefix field, enter lg.
    3. In the URI field, enter java:large.client
    4. Click Add.
    5. The new namespace is displayed in the User Defined Namespaces area in the Namespace Definitions palette as shown in Figure 4-29.

      Figure 4-29 User Defined Namespace


      User Defined Namespace

  5. In the XQuery Expression text box, enter the following expression to specify how the new element is constructed:
  6. <lg:CreditRating>{data($creditRating)}</lg:CreditRating>

    where:

    • lg: is the namespace of the element that you add to the message that should be associated with the java:large.client namespace.
    • {} indicates to the XQuery engine that the content between the {} is not XML and must be interpreted.
    • At run time, the $creditRating variable is assigned a credit rating value by the CreditRating business service. (This is the business service to which we configured a Service Callout action in section Add a Service Callout Action).

  7. Click Validate, then Save.
  8. Note: It is good practice is to validate the expression before you submit it.
  9. In the Insert action, select after from the drop-down list.
  10. Click the <XPath> link. The page is displayed.
    1. Click Variable Structures. The Variable Structures pane is displayed.
    2. In the Select Structure drop-down list in the Variables Structures pane, select body.
    3. Expand the element list and drag the Notes element and drop it into the XPath Expression text box.
    4. The following XPath expression is written to the text box

      ./exam:processLoanApp/loanRequest/java:Notes

      Note: The drag-and-drop functionality works only in Internet Explorer (IE) browsers. If you are using a browser other than IE, select the Notes element in the Variable Structures pane. The XPath expression is displayed in the Property Inspector palette. Place the cursor in the XPath 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 XPath Expression text box.
  11. In this statement, replace the namespace java with the namespace lg
  12. ./exam:processLoanApp/loanRequest/lg:Notes
    Figure 4-30 Configure Outbound Message


    Configure Outbound Message

  13. Click Validate, then Save to return to the Edit Stage Configuration page.
  14. Enter body in the Variable text field (the last field in the expression). This is the context variable into which the new <CreditRating> element is inserted at run time.
  15. The Insert action will be displayed as shown in Figure 4-31.

    Figure 4-31 Insert New Element into Message


    Insert New Element into Message

This task completes the configuration of the outbound message. You have added a credit rating element to the message and changed the message namespace so that the message complies with the public contract (interface) of the target service.

The configuration of the outbound message will be displayed as shown in the following figures.

Figure 4-32 Configuration of Outbound Message

Configuration of Outbound Message

The next task describes how you can configure the response actions for the LoanGateway2 proxy service.

Configure Routing Response Actions for LoanGateway2 Proxy Service

This section describes how you can configure the response actions in the Routing Table so that the message that is returned by the proxy service to the client complies with the client’s public contract (WSDL). You can configure the proxy service to:

Delete an Element
  1. Ensure that the Edit Stage Configuration page for the routing table that you created and configured in the preceding tasks is open in the ALSB Console.
  2. In the routing table Response Actions pane, select Add an ActionArrow symbolMessage ProcessingArrow symbolDelete.
  3. The Delete action configuration fields are added to the Routing Table Response Actions.

  4. Select the <XPath> in variable option, then click <XPath>. The XPath Expression Editor page is displayed.
    1. In the XPath Expression text box, enter the following expression:
    2. ./exam:processLoanAppResponse/return/lg:CreditRating 

      where <processLoanAppResponse> is the WSDL operation that was invoked with the string Response appended to it, and return is the WSDL part name.

    3. Click Validate, then Save. Edit Stage Configuration page is displayed.
  5. Enter body in the variable text field of the <XPath> in variable option in the Delete action.
  6. The configuration for the Delete action is therefore:

    Delete ./exam:processLoanAppResponse/return/lg:CreditRating in variable body as shown in Figure 4-33.

    Figure 4-33 Response Delete Action


    Response Delete Action

You have configured ALSB to remove the <CreditRating> element from the response message, when the message is processed in the response pipeline.

Add a Rename Action

This section describes how you can rename the namespace to the namespace that the client requires, that is java:normal.client.

Note: Recall that you configured the request message to the LoanSaleProcessor business service to change the namespace to that required by that service. (See Rename the Message Namespace).
  1. Click the Delete icon, then Add an ActionArrow symbolMessage ProcessingArrow symbolRename.
  2. The Rename action configuration fields are added to the Response Actions pipeline.

  3. In the Rename statement, click <XPath>. The XPath Expression Editor is displayed.
    1. In the XPath Expression text box, enter the following expression:
    2. .//lg:*

      This XPath expression finds every namespace with a prefix of lg:

    3. Click Save. The Edit Stage Configuration page is displayed.
  4. In the Rename action’s variable text field enter body.
  5. Select the namespace option, and in the text field associated with the namespace, enter java:normal.client
  6. When these tasks are completed, you have specified that ALSB replaces all namespaces with the prefix lg: in the response message with java:normal.client as shown in Figure 4-34.

    Figure 4-34 Add Rename Action


    Add Rename Action

After these tasks are complete, the response action configuration of the proxy service will be displayed as shown in Figure 4-35.

Figure 4-35 Configuration of Response Actions of Proxy Service

Configuration of Response Actions of Proxy Service

The last task in the configuration of the routing table for the LoanGateway2 proxy service is to add a default routing case (an else condition) to the case expression.

Add a Default Routing Case

This section describes how you can configure a default routing case for the routing table of the LoanGateway2 proxy service. At run time, if none of the conditions configured in the Routing Table are met, ALSB routes messages according to the configuration of this default case.

  1. Click the Case icon, then select Insert Default Case.
  2. The default case is added after the routing table on the Edit Stage Configuration page.

  3. Click <Service> in the default case to display the Select Services page.
    1. Select the NormalLoan business service.
    2. Click Submit.
  4. In the default case configuration operation drop-down list, select the operation processLoanApp as shown in Figure 4-36.
  5. Figure 4-36 Add Default Routing Case


    Add Default Routing Case

  6. Click Save to save the route node configuration and return to the Edit Message Flow page for the LoanGateway2 proxy service.
  7. Click Save on each configuration page until you return to the Edit Message Flow page.
  8. Click Activate, and then Submit to save the session configuration information.

The message flow map of the proxy service will be displayed as shown in Figure 4-37.

Figure 4-37 Map of Message Flow of the LoanGateway2 Proxy Service

Map of Message Flow of the LoanGateway2 Proxy Service

Figure 4-38 shows the complete route node for LoanGateway2.

Figure 4-38 Configuration of the Route Node for LoanGateway2

Configuration of the Route Node for LoanGateway2

Test the Loan Application Routing Configuration Using the Test Console

This section describes how to test the loan application using the test console. To test the loan, you must first deploy the client jars in the WLS console. For more information see, Load the Client Application.

To test the Routing of the Loan Application Using LoanSaleProcessor Service

  1. Start WLS Server in ServiceBusTutorial Domain
  2. In ALSB Console activate the current session.
  3. Click on Resource Browser in the left panel to navigate to Summary of Proxy Services page.Click on Launch Test Console icon in Actions column for LoanGateway2 to launch the test console (see Figure 3-40).
  4. Replace the default payload in loanRequest field with the following code:
  5. <loanRequest xmlns:java="java:normal.client">
        <!--Optional:-->
        <java:Name>Smith</java:Name>
        <!--Optional:-->
        <java:SSN>1234567</java:SSN>
        <!--Optional:-->
        <java:Rate>5</java:Rate>
        <!--Optional:-->
        <java:Amount>900000000</java:Amount>
        <!--Optional:-->
        <java:NumOfYear>10</java:NumOfYear>
        <!--Optional:-->
        <java:Notes>Large Loan Processing</java:Notes>
    </loanRequest>

Accept other default settings and click Execute. The response as in Figure 4-39.

Figure 4-39 Response From LoanSaleProcessor Business Service

Response From LoanSaleProcessor Business Service

The response message indicates that the proxy service LoanGateway2 routes the application to LoanSale Processor processed the request because the amount of the loan requested is greater than US $25 million.

Test the NormalLoan Business Service

  1. Start WLS Server in ServiceBusTutorial Domain
  2. In ALSB Console activate the current session.
  3. Click on Resource Browser in the left panel to navigate to Summary of Proxy Services page.Click on Launch Test Console icon in Actions column for LoanGateway2 to launch the test console (see Figure 3-40).
  4. Replace the default payload in loanRequest field with the following code:
  5. <loanRequest xmlns:java="java:normal.client">
        <!--Optional:-->
        <java:Name>Smith</java:Name>
        <!--Optional:-->
        <java:SSN>1234567</java:SSN>
        <!--Optional:-->
        <java:Rate>5</java:Rate>
        <!--Optional:-->
        <java:Amount>2000000</java:Amount>
        <!--Optional:-->
        <java:NumOfYear>10</java:NumOfYear>
        <!--Optional:-->
        <java:Notes>Normal Loan</java:Notes>
    </loanRequest>

Accept other default settings and click Execute. The response as in Figure 4-40.

Figure 4-40 Response from NormalLoanProcessor

Response from NormalLoanProcessor

The response message indicates that the proxy service LoanGateway2 routes the application to NormalLoanApproval business service processed the request because the amount of the loan requested was less than US $25 million.

 


Best Practices

In this tutorial, you configured the transformation and replaced the namespaces in the Route node. Alternatively, it is possible to configure the same logic in the request pipeline in a pipeline pair. The work you must do to accomplish the transformation and namespace replacement is the same regardless of the model that you choose.

In the case of the tutorial scenario, it is easier to add the actions to the request and response actions of the existing route node rather than create a separate pipeline pair, add a stage, and then add the transformation actions to that stage.


  Back to Top       Previous  Next