< Previous | Next >

Task 3: Debugging a remote ruleset in Rule Designer

You debug the ruleset in Rule Designer.

About this task

You run the ruleset by using the REST execution in the Rule Execution Server console, and debug the ruleset in Rule Designer.

Step 1: Running the ruleset by using REST in the Rule Execution Server console

About this task

You run the ruleset in the Rule Execution Server console.

Procedure

  1. Switch to the Samples Console perspective, and click Rule Execution Server console in the Sample Server view.
  2. Log in by using resAdmin as the user name and password.
  3. Click the Explorer tab. In the Navigator pane, expand RuleApps/loanvalidation_debugging/1.0 and select loanvalidation_rulesRuleset/1.0 to open the ruleset view.
  4. In the Ruleset View, click on Retrieve HTDS Description File.
  5. Select REST in the service protocol type field, and select the OpenAPI - JSON format.
  6. Click Test, and wait for the console to generate the default data.
  7. Replace the request contents as follows:
    {
    "loan": {
    "numberOfMonthlyPayments": 70,
    "startDate": "2016-10-19T17:27:14.000+0000",
    "amount": 100000,
    "loanToValue": 0.7},
    "borrower": {
    "firstName": "Joe",
    "lastName": "Doe",
    "birth": "1987-09-29T01:49:45.000+0000",
    "SSN": {
    "areaNumber": "424",
    "groupCode": "56",
    "serialNumber": "7942"
    },
    "yearlyIncome": 100000,
    "zipCode": "95372",
    "creditScore": 600,
    "latestBankruptcy": {
    "date": "2014-09-18T23:18:33.000+0000",
    "chapter": 3,
    "reason": "Summer loss"
    }
    }
    } 
  8. Click Execute Request.

Step 2: Debugging the ruleset in Rule Designer

About this task

The debugger stopped the execution in the ruleflow at the breakpoint in the computation task.

Image shows the debugger stopping at a breakpoint.

Procedure

  1. In Rule Designer, click Run > Resume. The debugger stops the execution at the breakpoint in the initialCorporateScore rule.
  2. Click the Agenda tab.
    Image shows the agenda.

    The agenda has the following rules: initialCorporateScore, neverBankruptcy, salary2Score_6, repayment, rate_6. This order is not correct because the repayment calculation uses the rate values.

  3. Click Run > Resume.

    The debugger stops the execution at the breakpoint in the repayment rule.

  4. Click Window > Show View  > Variables.
  5. In the Variables view, click the rate variable.
    Image shows the rate variables.
    The loan repayment is calculated at the following line in the repayment rule:
    set the monthly repayment of 'the loan' to the computed monthly  repayment
        for a loan of amount during duration with a yearly rate of  rate ;

    The value is calculated on the rate variable value, which is set to 0.0. The rate value is not computed yet because of the order of the rules in the agenda.

    The rate rule is after the repayment rule in the agenda because it has the same priority, and there is no way to ensure the order in which these two rules are run.

  6. Click Run > Resume.
  7. In the REST Service page, you can see the following in the server response.
    ..    
    "insuranceRate": 0,    
    "approved": false,
    "messages": [      
    "We are sorry. Your loan has not been approved"    
    ],
    "insurance": "none",
    ..

What to do next

In the next task, you find and fix an error, and then deploy the corrected ruleset.
< Previous | Next >