< 上一個課程 | 下一個課程 >

作業 3:在 Rule Designer 中對遠端規則集除錯

在 Rule Designer 中對規則集除錯。

關於這項作業

在 Rule Execution Server 主控台中執行 REST 來執行規則集,並在 Rule Designer 中對規則集除錯。

步驟 1:在 Rule Execution Server 主控台中使用 REST,來執行規則集

關於這項作業

在 Rule Execution Server 主控台中執行規則集。

程序

  1. 切換至「範例主控台」視景,並在「範例伺服器」視圖中,按一下 Rule Execution Server 主控台。
  2. 使用 resAdmin 作為使用者名稱與密碼來登入。
  3. 按一下瀏覽器標籤。在「導覽器」中,展開 RuleApps/loanvalidation_debugging/1.0,並選取 loanvalidation_rulesRuleset/1.0,以開啟規則集視圖。
  4. 在「規則集視圖」中,按一下擷取 HTDS 說明檔。
  5. 在「服務通訊協定類型」欄位中,選取 REST,並選取 OpenAPI - JSON 格式。
  6. 按一下測試,並等待主控台產生預設資料。
  7. 依如下所示,取代要求內容:
    {
    "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. 按一下執行要求。

步驟 2:在 Rule Designer 中對規則集除錯

關於這項作業

除錯器在規則流程中,因遇到 computation 作業中的岔斷點而停止執行。

影像顯示除錯器停止於岔斷點。

程序

  1. 在 Rule Designer 中,按一下執行 > 回復。除錯器遇到 initialCorporateScore 規則中的岔斷點,而停止執行。
  2. 按一下議程標籤。
    影像顯示議程。

    議程具有下列規則:initialCorporateScore、neverBankruptcy、salary2Score_6、repayment、rate_6。這樣的順序不正確,因為計算還款時會使用 rate 值。

  3. 按一下執行 > 回復。

    除錯器遇到 repayment 規則中的岔斷點,而停止執行。

  4. 按一下視窗 > 顯示視圖 > 變數。
  5. 在「變數」視圖中,按一下 rate 變數。
    影像顯示 rate 變數。
    repayment 規則的下一行會計算貸款還款:
    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 ;

    會在設為 0.0 的 rate 變數值中計算值。基於議程中規則順序的原因,尚未計算 rate 值。

    在議程中,rate 規則位於 repayment 規則之後, 這是因為它具有相同的優先順序,且目前無從確保這兩項規則會依照順序執行。

  6. 按一下執行 > 回復。
  7. 在「REST 服務」頁面中,您可以在伺服器回應中看到如下。
    ..    
    "insuranceRate": 0,    
    "approved": false,    
    "messages": [      
    "We are sorry. Your loan has not been approved"    
    ],
    "insurance": "none",
    ..

下一步

在下一項作業中,您將尋找並修正錯誤,然後部署已更正的規則集。
< 上一個課程 | 下一個課程 >