Using Drools 5.5.0.Final with Guvnor 5.5.0.Final with the sample mortgages package.
When submitting REST json request with the following Batch Execution Command:
{
"batch-execution": {
"lookup":"ksession1",
"commands":[
{
"insert":{
"out-identifier":"outApplicant",
"return-object":"true",
"object": {
"Applicant":{
"age":17
}
}
}
},
{
"fire-all-rules":""
}
]
}
}
returns: 500 Internal Server Error
com.thoughtworks.xstream.converters.ConversionException: Applicant : Applicant
---- Debugging information ----
message : Applicant
cause-exception : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message : Applicant
class : org.drools.command.runtime.rule.InsertObjectCommand
required-type : org.drools.command.runtime.rule.InsertObjectCommand
converter-type : org.drools.runtime.help.impl.XStreamJson$JsonInsertConverter
line number : -1
class[1] : org.drools.command.runtime.BatchExecutionCommandImpl
converter-type[1] : org.drools.runtime.help..XSt...$JsonBatchExecutionCommandConverter
version : null
The Applicant class is defined in the mortgages package within an XSD like so:
age:Whole number (integer)
applicationDate:Date
creditRating:Text
name:Text
approved:True or False
How can I tell drools where to find the Applicant class? ( which is defined in the mortgage sample as an XSD file)
knowledge-services.xml currently looks like this:
<drools:grid-node id="node1"/>
<drools:kbase id="kbase1" node="node1">
<drools:resources>
<drools:resource type="PKG" source="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/packages/mortgages"/>
</drools:resources>
</drools:kbase>
I suspect that changing the REST json request to fully specify the package name for Applicant class might work.
...
"object": {
"something.somethingelse.Applicant":{
"age":17
}
}
...
But can't seem to find where the fully qualified package name for Applicant is declared?
Acceptable answer must show an example which works without having to write java code, since the whole point of the REST interface is to access drools through a web service interface.
Is there a spring configuration , or some other way to write the json request that will work?