I could setup KIE Execution Server (6.3.0.Final) and Workbench (6.3.0.Final) on Wildfly 8.1.0.Final using information available in blog: http://mswiderski.blogspot.in/2015/10/installing-kie-server-and-workbench-on.html Both server and Workbench are working fine and Server is visible in Workbench under "Server Management Browser" tab.
My next step is to deploy a simple container on server and test REST GET and POST calls, hence I followed steps mentioned in Question: HelloWorld using Drools Workbench & KIE Server
The only change in Java and DRL code is with respect to package. Below is my Java code:
package test.myproject;
/**
* This class was automatically generated by the data modeler tool.
*/
public class HelloWorld implements java.io.Serializable
{
static final long serialVersionUID = 1L;
private java.lang.String message;
public HelloWorld()
{
}
public java.lang.String getMessage()
{
return this.message;
}
public void setMessage(java.lang.String message)
{
this.message = message;
}
public HelloWorld(java.lang.String message)
{
this.message = message;
}
}
DRL file code:
package test.myproject;
import test.myproject.HelloWorld;
rule "hello"
when
HelloWorld(message == "Joe");
then
System.out.println("Hello Joe!");
end
The code is built successfully and deployed as container on the server. A GET Query using RESTClient/PostMan/Advanced REST Client gives proper response.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="Info for container myproject">
<kie-container container-id="myproject" status="STARTED">
<release-id>
<artifact-id>MyProject</artifact-id>
<group-id>test</group-id>
<version>1.0</version>
</release-id>
<resolved-release-id>
<artifact-id>MyProject</artifact-id>
<group-id>test</group-id>
<version>1.0</version>
</resolved-release-id>
<scanner status="DISPOSED"/>
</kie-container>
</response>
However When I POST to container with below content:
<batch-execution lookup="defaultKieSession">
<insert out-identifier="message" return-object="true" entrypoint="DEFAULT">
<test.myproject.HelloWorld>
<message>Joe</message>
</test.myproject.HelloWorld>
</insert>
Note that I did make changes to XML as per change in code. I did try with different options like etc, but I get response as :
Status Code: 405 Method Not Allowed
Allow: HEAD, DELETE, GET, OPTIONS, PUT
Cache-Control: no-cache, no-store, must-revalidate
Connection: keep-alive
Content-Length: 0
Date: Thu, 10 Dec 2015 05:29:09 GMT
Expires: 0
Pragma: no-cache
Server: WildFly/8
X-Powered-By: Undertow/1
Looks like POST option is not allowed, Hence tried PUT but got response as:
Status Code: 415 Unsupported Media Type
Cache-Control: no-cache, no-store, must-revalidate
Connection: keep-alive
Content-Length: 0
Date: Thu, 10 Dec 2015 05:32:17 GMT
Expires: 0
Pragma: no-cache
Server: WildFly/8
X-Powered-By: Undertow/1
Can anyone tell me where I am going wrong. I also checked log file and see below error when POST is called:
2015-12-10 10:59:09,208 WARN [org.jboss.resteasy.core.ExceptionHandler] (default task-48) failed to execute: javax.ws.rs.NotAllowedException: No resource method found for POST, return 405 with Allow header at org.jboss.resteasy.core.registry.SegmentNode.match(SegmentNode.java:375) [resteasy-jaxrs-3.0.8.Final.jar:] at org.jboss.resteasy.core.registry.SegmentNode.match(SegmentNode.java:114) [resteasy-jaxrs-3.0.8.Final.jar:]
and error when PUT is called:
2015-12-10 11:02:17,127 WARN [org.jboss.resteasy.core.ExceptionHandler] (default task-50) failed to execute: javax.ws.rs.NotSupportedException: Cannot consume content type at org.jboss.resteasy.core.registry.SegmentNode.match(SegmentNode.java:380) [resteasy-jaxrs-3.0.8.Final.jar:] at org.jboss.resteasy.core.registry.SegmentNode.match(SegmentNode.java:114) [resteasy-jaxrs-3.0.8.Final.jar:]