Simple execution sample details
You use a web browser to run the sample application.
Running this sample application
To run the sample application:
- Open a web browser, and enter the URL for the sample
application:
http://localhost:9090/rulesession
The following page opens in your browser:

- Click the Validate Loan button. You get a message that says the loan is rejected.
- Change the Amount field to 20000, and click the Validate Loan button. The loan is approved this time.
Removing the sample application
To remove the sample application:
- Open the Rule Execution Server console:
- URL: http://localhost:9090/res
- User name and password: resAdmin
- In the Explorer tab, you can see that the my_deployment RuleApp is deployed.
- In the Samples Console, open the Samples Command tab and expand .
- Double-click undeployMiniloan to use the command.
- Refresh the Rule Execution Server console. The RuleApp and resources are no longer deployed.
If you try to use the rulesession application now, you get an error that says the decision service is not deployed.
Rebuilding the sample
To rebuild the sample:
- Open the Samples Console.
- In the Samples Command tab,expand .
- Double-click the clean command. This command removes the built classes, and the RuleApp and its XOM from the Rule Execution Server database.
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™ Script. The call is done by processing a POST request in AJAX:
- The parameters are provided as JSON objects.
- The RuleApp URL is used: /DecisionService/rest/v1/my_deployment/my_operation.
- The data from the request is parsed to get the information to display.
Source files
- Sample project for the web application:
<InstallDir>/executionserver/samples/j2eerulesession/miniloan-rest
Look in the src/main/webapp/js/main.js Java script file for the call to the REST API.
- XOM source files: <InstallDir>/gettingstarted/DecisionServer/start/miniloan-xom
- Decision service files: <InstallDir>/gettingstarted/DecisionServer/answer/Miniloan Service
- Open the Samples Console.
- Open the Samples and Tutorials tab and expand .
- Under Simple execution, click Import projects.
- Switch to the Java perspective to view and modify the projects.