Ruleset execution sample details

You use a web browser to run the sample application.

Running this sample

To run the sample application:

  1. In your web browser, open the sample application by using this URL:
    http://localhost:9090/loan-server

    The following page opens in your browser:

    Image shows the sample application.
  2. Click the Validate Loan button. You get a message that says the loan is rejected.
  3. Change the value in the Amount field to 20000, and click the Validate Loan button. The loan is approved this time:
    Image shows the approved loan.
  4. Open the Additional Info tab to see data on the borrower. Change the zip code to 12 and validate the loan. You get the following message.
    The borrower's Zip Code should have 5 digits
  5. Open the Execution Details tab, where you can set the execution server URL, ruleset name, and login credentials for the server. Select the Trace output box, and validate the loan. The output displays the execution trace.

Rebuilding this sample

To rebuild this sample:

  1. Open the Samples Console.
  2. In the Samples Commands tab, expand Samples Commands > Rule Execution Server > Ruleset execution.
  3. Double-click the clean command to remove the build classes and directories.

How this sample works

This sample demonstrates how to call a decision service by using its REST API in a web application. You build a RuleApp by using the build command, and deploy it to Rule Execution Server in the sample server by using the Ant task res-desploy. Then, you run a decision service from a web interface in Java™:
  • The parameters are provided as JSON objects.
  • The data from the request is parsed to get the information to display.

Source files

The source files for the sample web application are in the following directory:
  • <InstallDir>/executionserver/samples/rulesetexecution/loan-server

You can view and modify the sample source files in Rule Designer.

To import the sample into your workspace:
  1. Open the Samples Console.
  2. Open the Samples and Tutorials tab and expand Rule Execution Server > Samples.
  3. Under Ruleset execution, click Import projects.
  4. Switch to the Java perspective to view and modify the projects.