将 Drools 5.5.0.Final 与 Guvnor 5.5.0.Final 与示例抵押贷款包一起使用。
使用以下批处理执行命令提交 REST json 请求时:
{
"batch-execution": {
"lookup":"ksession1",
"commands":[
{
"insert":{
"out-identifier":"outApplicant",
"return-object":"true",
"object": {
"Applicant":{
"age":17
}
}
}
},
{
"fire-all-rules":""
}
]
}
}
返回:500 内部服务器错误
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
申请人类在 XSD 中的抵押包中定义,如下所示:
age:Whole number (integer)
applicationDate:Date
creditRating:Text
name:Text
approved:True or False
我如何告诉流口水在哪里可以找到应聘者课程?(在抵押贷款样本中定义为 XSD 文件)
Knowledge-services.xml 目前看起来像这样:
<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>
我怀疑更改 REST json 请求以完全指定申请人类的包名称可能会起作用。
...
"object": {
"something.somethingelse.Applicant":{
"age":17
}
}
...
但似乎找不到申请人的完全限定包名称在哪里声明?
可接受的答案必须展示一个无需编写 java 代码即可工作的示例,因为 REST 接口的全部意义在于通过 Web 服务接口访问流口水。
是否有 spring 配置或其他方式来编写可以工作的 json 请求?