< Previous | Next >

Task 2: Ensuring the ruleset is usable in REST

You view the ruleset and test it in the Rule Execution Server console.

About this task

You test your ruleset in REST by using the OpenAPI.

Procedure

  1. Open the Rule Execution Server console by switching to the Samples Console perspective and clicking Rule Execution Server console in the Sample Server view. You use the console in the remaining tasks of the tutorial.
  2. Log in by using resAdmin as the user name and password.
  3. Click the Explorer tab. In the Navigator pane, expand the RuleApps.
  4. Expand /PreTradeChecksRuleApp/1.0, and click PreTradeChecks/1.0.
  5. In the Ruleset View page, click Retrieve HTDS Description File.
  6. Select REST in the Service protocol type field, and select the Open API - JSON option.
  7. Select the Decision trace information option, and then click Test.
  8. Set the customer parameter as shown in the following text:
    "customerParameter": {
    "name": "John Smith",
    "owner": "George Smith@IBM",
    "initialValue": 2000,
    "currentValue": 800,
    "sectorPosition": 800,
    "bankStockPosition": 800,
    "oilStockPosition": 800,
    "railStockPosition": 800,
    "bondPosition": 800,
    "futurPosition": 800,
    "stockPosition": 800,
    "currency": "EURO"
    },
  9. Set the order parameter as shown in the following text:
    "orderParameter": {    
    "id": "string",    
    "stock":
    "Company X",    
    "amount": 90,    
    "exchange": "Nouveau Marche",
    "currency": "EURO",    
    "destination": "France",    
    "action": "BUY",    
    "securityType": "STOCK",    
    "dateTime": "2004-02-14T19:44:14.000+0000",    
    "sector": "OIL",    
    "status": "PENDING",    
    "reasons": "BAD_CLIENT"  
    },
  10. Set the trace parameters that are described by TraceFilter. Set the none and infoTotalRulesFired parameters to true. Set the rest of the trace parameters to false.
  11. Click the Execute Request button, and check the Server Response section:
    {  
    "__decisionTrace__": {    
    "totalRulesFired": 4
    },  
    "__DecisionID__": "string",  
    "reportParameter": {   
    "id": "string",    
    "stock": "Company X",    
    "amount": 90,    
    "exchange": "Nouveau Marche",    
    "currency": "EURO",    
    "destination": "France",
    "action": "BUY",    
    "securityType": "STOCK",    
    "dateTime": "2004-02-14T19:44:14.000+0000",    
    "sector": "OIL",    
    "status": "BLOCKED",    
    "reasons": "BLACK_LIST_STOCKS"  }} 

    The trace shows that four rules were run. The order status was blocked because of BlackListStocks.

What to do next

In the next task, you continue working in the Rule Execution Server console. You retrieve an OpenAPI description and call the service in a generated client.
< Previous | Next >