OpenRules business decision models can be deployed as a RESTful web service that accepts HTTP requests at your local or remote server and produces the proper responses in the JSON format. Internally it uses SpringBoot but you don’t have to become an expert in this popular and powerful software.
The standard installation includes the project “VacationDaysSpringBoot” that demonstrates all deployment details. As usual, you create and test your decision model in Excel and then simply add the property “spring.boot=On” to the file “project.properties”. Then you double-click on the provide file “runLocalServer.bat” (the same for all models). When you double-click on it for the first time, it will install the necessary software (including SpringBoot jar-files). Then it will build your model in such a way that it can be deployed as a RESTful web service on the local server. After a successful start of the server you should see a console screen that looks like this one:
To test your RESTful web service, double-click on the provide file “testLocalServer.bat” (the same for all models). When you double-click on this file, it will run a test and you will see the results on both (server and client) screens similar to this picture:
Invoking the Service From Java. The example “VacationDaysSpringBoot” includes the Java class “TestLocalServer” (in the folder “src”) that demonstrates how to invoke the deployed service from Java. Here is the code:
Here are the execution results:
You also may test your model with the commonly used POSTMAN.
You can package your application into a jar-file by double-clicking on the provided file “package.bat”. It will generate an executable JAR file such as “VacationDaysSpringBoot-1.0-SNAPSHOT.jar” in the folder “target”. You can use this file directly to start your web service on your local or remote server with the standard command “java -jar VacationDaysSpringBoot-1.0-SNAPSHOT.jar“. You may move this jar-file to any location and it will work as well. This file is ready to be uploaded to AWS or another cloud repository to invoke our decision service remotely.