1

我使用 Jboss BRMS 中的决策表创建了一个规则,并使用 kie-server 部署为 REST 服务。但是找不到如何将参数传递给服务。

当我创建一个测试场景并执行规则服务时,它运行良好。

kie-container 向我显示终点为
http://host:port/kie-server/services/rest/server/containers/container1

但我找不到如何使用 Rest Client(Advanced Rest Client)将参数传递给服务。

我将这个参数与请求一起发送,它给了我以下响应。

要求

{
 "commands":[
   {
      "insert":{
         "out-identifier":"Customer",
         "return-object":"true",
         "object": {
           "example.si.Customer":{
             "time":3,
             "age":70,
             "gender":"MALE"
           }
         }
       }
   },
   {
      "fire-all-rules":""
   }
 ]
  }

  >HEADERS
    X-KIE-ContentType: JSON
    Accept: application/json
    Content-Type: application/json
    authorization: Basic a2llc2VydmVyOmtpZXNlcnZlcjEh


>RESPONSE
     {
      "type": "SUCCESS"
       "msg": "Container sinterest5 successfully called."
       "result": "{ "results" : [ { "key" : "", "value" : 0 }, { "key"   : "Customer", "value" : {"example.si.Customer":{ "time" : 3, "age" : 70,   "interest" : null, "gender" : "MALE", "rate" : null, "amount" : null }} } ], "facts" : [ { "key" : "Customer", "value" :     {"org.drools.core.common.DefaultFactHandle":{ "external-form" : "0:5:695977235:695977235:5:DEFAULT:NON_TRAIT:example.si.Customer" }} } ]     }"
       }



 And my Rule is.. 


package Deciding_Rates;
   //generated from Decision Table
   import example.si.Customer;
  function void interest(int time, int rate, int amount)
  {System.out.println ( (time * rate * amount )/100        );System.out.println(System.currentTimeMillis());}
        lock-on-active true
       // rule values at C15, header at C10
         rule "DecidingRate_15"
        ruleflow-group "Rate"
        when
         $customer : Customer(Time< 5, Age>=65, Gender == "MALE")
         then
        modify($customer){setRate(10)};
       System.out.println("Time < 5, Senior, Male");
       interest($customer.getTime(), $customer.getRate(), 100);
  end

     // rule values at C16, header at C10
      rule "DecidingRate_16"
      ruleflow-group "Rate"
      when
          $customer : Customer(Time< 5, Age>=65, Gender == "FEMALE")
      then
         modify($customer){setRate(11)};
         System.out.println("Time < 5, Senior, Female");
         interest($customer.getTime(), $customer.getRate(), 100);
       end

       // rule values at C17, header at C10
        rule "DecidingRate_17"
        ruleflow-group "Rate"
        when
         $customer : Customer(Time< 5, Age<65, Gender == "MALE")
        then
         modify($customer){setRate(8)};
         System.out.println("Time < 5, young, Male");
          interest($customer.getTime(), $customer.getRate(), 100);
          end

我在这里做错什么了吗?Sysouts 在服务器日志中不可见。我不确定我的规则是否被解雇。

4

1 回答 1

0

错误在您的URL中:
您正在使用:
http://host:port/kie-server/services/rest/server/containers/container1

试试:
http://host:port/kie-server/services/rest/server/containers/instances/container1

于 2017-01-17T10:28:36.813 回答