REST-based interface to OpenRules?

81 views
Skip to first unread message

Andrzej Taramina

unread,
Feb 7, 2019, 8:32:21 AM2/7/19
to OpenRules
Has anyone implemented a REST-based interface to OpenRules?  SOAP-based web services are archaic and too heavy/complex compared to the alternatives.

If so, XML or JSON as input format?

Thanks!

....Andrzej

openru...@gmail.com

unread,
Feb 8, 2019, 2:21:07 PM2/8/19
to OpenRules

openru...@gmail.com

unread,
Feb 9, 2019, 9:57:01 AM2/9/19
to OpenRules

Andrzej Taramina

unread,
Feb 10, 2019, 2:00:23 PM2/10/19
to OpenRules

Thanks....that is very helpful!

I've been trying to figure out from the documentation if there is a way to get data in and out of OpenRules (from Java) without having to create javabeans?

Creating static javabeans makes it more involved to deploy revised rules when using a REST-based wrapper.  What I'ld ideally like to be able to do is to dynamically take data coming in from a REST request (as either JSON or maybe XML, likely also specifying the output variables that should be returned), using element naming conventions, set that data and run the OpenRules engine, then formulate a response dynamically as well.

That would make deployment more flexible, so long as you kept the requests aligned with the rules.

Thanks!

openru...@gmail.com

unread,
Feb 11, 2019, 1:52:14 PM2/11/19
to OpenRules
You may consider another OpenRules API known as BusinessMap - see http://openrules.com/pdf/OpenRulesUserManual.Part2.pdf p.96. If you like to suggest your specific implementation, we may add it as well if it is generic enough. 
Support

Andrzej Taramina

unread,
Feb 11, 2019, 2:23:08 PM2/11/19
to OpenRules
The issue with the BusinessMap approach is that you still have to have Customer/Response classes (per page 96 example).

What I was looking for is an API approach that requires no generated (or hand coded classes).

Maybe something like this:

GenericMap customer = GenericMap.createMap( "Customer" );

customer.setAttribute( "name", "Robinson" );
etc...

decision.addGenericMap( customer );
etc...

With this approach there would be no java classes (or javabeans) required to be generated/coded....the linkage to the decision model business concept would be through the label provided in the createMap method.

Using this approach, any arbitrary incoming data (eg. json message) could be used to populate business concepts.....one could then write generic code once that would set the attributes for all concepts by iterating across the input data.

Obviously, this means that other mechanisms would be required to keep the incoming data (eg, messages) in sync with the rules in the .xls, but that is a reasonable tradeoff in my mind to enabled easier/simpler deployment of revisions/changes.

....A



etc...

Jacob Feldman

unread,
Jun 20, 2019, 8:43:25 AM6/20/19
to OpenRules
You may also want to look at this tutorial "Developing Decision Microservices with Spring Boot and OpenRules". Here an OpenRules-based decision model is deployed as a decision microservice and you can interact with it using JSON or XML from POSTMAN or from your own Java client. The supporting Eclipse projects are available for free downloads as a part of the evaluation version  - see "openrules.spring".


On Thursday, February 7, 2019 at 8:32:21 AM UTC-5, Andrzej Taramina wrote:

Koon Sang Khong

unread,
Mar 12, 2020, 10:47:08 AM3/12/20
to OpenRules
No difference.  You still need to define the Java BOM (Business Object Model)/POJO. 

support

unread,
Mar 12, 2020, 10:56:44 AM3/12/20
to OpenRules
The latest OpenRules Decision Manager provides an automatic deployment of business decision models as RESTful Web Service without necessity to define Java BOM or any programming. Download (for free!) the latest version, and look at the sample project VacationDaysSpringBoot. It takes the basic business decision model defined in Excel in the sample "VacationDays" and automatically generates necessary Java code to support a RESTful web service.With zero(!) coding you simply click on "runLocalServer.bat" and your web service  is ready to be tested using "testLocalSerrver.bat" or POSTMAN. See the details here.
Reply all
Reply to author
Forward
0 new messages