-
1. Re: How to execute rules deployed to the kie-server via REST ?
abhijithumbe Sep 4, 2015 1:14 AM (in response to simplex-software)Hi,
To execute rules through kie-server refer Chapter 19. KIE Execution Server
-
2. Re: How to execute rules deployed to the kie-server via REST ?
simplex-software Sep 4, 2015 11:52 AM (in response to abhijithumbe)Hello,
Many thanks for the info. Yes, this doc seems much better then the RedHat's one.
However, it doesn't neither illustrate with examples. Given that my container kie-server instance is named container-0, I tried to follow the documentation and I did that:
curl -d "<fire-all-rules/>" http://localhost:8080/kie-server/services/rest/server/containers/container-0
and I got:
<html>
<head>
<title>JBoss Web/7.5.7.Final-redhat-1 - JBWEB000064: Error report</title>
<style>...</style>
</head>
<body>
<h1>JBWEB000065: HTTP Status 401</h1>
<u>JBWEB000121: This request requires HTTP authentication.</u>
</body>
</html>
which is consistent as I need to authenticate. Then, I tried:
curl -u user:password -d "<fire-all-rules/>" http://localhost:8080/kie-erver/services/rest/server/containers/container-0
and I got:
<html>
<head>
<title>JBoss Web/7.5.7.Final-redhat-1 - JBWEB000064: Error report</title>
<style>...</style>
</head>
<body>
<h1>JBWEB000065: HTTP Status 415 - RESTEASY001055: Cannot consume content type</h1>
<u>JBWEB000135: The server refused this request because the request entity is in a format not supported by the requested resource for the requested method.</u>
</body>
</html>
However, doing just that:
curl -u user:password http://localhost:8080/kie-server/services/rest/server/containers/container-0
works as expected.
So, I still don't know how to invoke rules deployed in the kie-server container. Any idea ?
Many thanks in advance.
Nicolas
-
3. Re: How to execute rules deployed to the kie-server via REST ?
abhijithumbe Sep 4, 2015 12:40 PM (in response to simplex-software)Hi,
Can you give a try with following URL
~~~
curl -i -X POST -H "Content-Type:application/xml" http://user:password@http://localhost:8080/kie-server/services/rest/server/containers/container-0 --data "<fire-all-rules/>"
~~~
-
4. Re: How to execute rules deployed to the kie-server via REST ?
simplex-software Sep 4, 2015 12:54 PM (in response to abhijithumbe)Hi,
Many thanks again. This curl request worked correctly once that I corrected the typo. I have already tried
curl -v -X POST -H "Content-Type:text/xml" -u user:password -d "<fire-all-rules/>" http://localhost:8080/kie-server/services/rest/server/containers/container-0
but it didn't work. So, finally, the "-i" and the fact of passing the credentials like http://user:password@... did the trick.
In my opinion, the documentation should mention this kind of trick somewhere as it is not obvious and probably many people spend hours to find the right way to invoke rules.
So many thanks for having unblocked me. Now, would it be any other way than REST to do the stuff, for example via a Java API usable in an EJB ? As a matter of fact, it would be too ridiculous to post HTYP requests in the same WAR !
Kind regards,
Nicolas
-
5. Re: How to execute rules deployed to the kie-server via REST ?
abhijithumbe Sep 8, 2015 6:16 AM (in response to simplex-software)Hi,
You can use KieScanner API's to execute rules as well. KieScanner is a maven-oriented replacement of the KnowledgeAgent present in Drools 5, it allows to continuously monitoring remote maven repository(http://10.10.10.10:8080/business-central/maven2/) to check if a new release of a Kie project has been installed(Build & Deploy in business-central). If new release be installed or -SNAPSHOT version be updated the KieScanner will pick up the new updates, put it to KieRepository and local maven repository.Go through Development Guide for more details.