郵便配達員からのRESTコールが期待した結果を返しても、RuleServiceClient
を使用してJavaアプリケーションからコールすると、Drools Execution Serverからの成功は受信されましたが、KIE RuleServicesClientが空のレスポンスを返します
私の質問:私のJavaコードで何が間違っていますか?
下記をご覧ください。
私は、サンプルのルールを作成した(フィールドMessage.MyField == 1
が、その後400
にこのフィールドを設定している場合)、私は郵便配達員を使ってKIE実行サーバー上でそれを発射することができました:http://SERVER:8080/kie-server-webc/services/rest/server/containers/instances/kie-container
へ
POSTリクエスト:
{
"lookup": "defaultStatelessKieSession",
"commands": [{
"insert": {
"object": {
"Message": {
"myField": 1
}
},
"disconnected": false,
"out-identifier": "Message",
"return-object": true,
"entry-point": "DEFAULT"
}
}, {
"fire-all-rules": {
"max": -1,
"out-identifier": null
}
}]
}
レスポンスを("myField": 500
を書き留めてください)
{
"type": "SUCCESS",
"msg": "Container kie-container successfully called.",
"result": {
"execution-results": {
"results": [
{
"key": "Message",
"value": {
"bnym.test1.Message": {
"myField": 500
}
}
}
],
"facts": [
{
"key": "Message",
"value": {
"org.drools.core.common.DefaultFactHandle": {
"external-form": "0:1:1208207159:1208207159:2:DEFAULT:NON_TRAIT:myProj.test1.Message"
}
}
}
]
}
}
}
マイJavaクライアントコードborrowe dはチュートリアルからです:
です。 。 。
private static String URL = "http://SERVER:8080/kie-server-webc/services/rest/server";
private static final String USER = "user";
private static final String PASSWORD = "pwd";
。 。 。
public void transform() throws Exception {
Message m = new Message();
m.myField = 1;
KieServicesConfiguration config = KieServicesFactory.newRestConfiguration(URL, USER, PASSWORD);
config.setMarshallingFormat(MarshallingFormat.JSON);
kieServicesClient = KieServicesFactory.newKieServicesClient(config);
RuleServicesClient rulesClient = kieServicesClient.getServicesClient(RuleServicesClient.class);
KieCommands commandsFactory = KieServices.Factory.get().getCommands();
Command<?> insert = commandsFactory.newInsert(m);
Command<?> fireAllRules = commandsFactory.newFireAllRules();
Command<?> batchCommand = commandsFactory.newBatchExecution(Arrays.asList(insert, fireAllRules)); //0
ServiceResponse<String> executeResponse = rulesClient.executeCommands("kie-container", batchCommand);
if(executeResponse.getType() == ResponseType.SUCCESS) {
System.out.println("Commands executed with success! Response: ");
System.out.println(executeResponse.getResult());
}
}
結果:
Commands executed with success! Response:
{
"results" : [ ],
"facts" : [ ]
}
私の質問:結果が空であるように、私のJavaコードで間違って何ですか?
は、私が送信された要求を確認し、それで正しいではありません見つけるためにあなたの他のものにそれを比較するために、クライアントのデバッグログをオンに勧めあなたに