[rules-users] Why the drools modified object does not reflect the changes when I call the remote web service?

Wolfgang Laun wolfgang.laun at gmail.com
Tue Jul 30 11:10:08 EDT 2013


There is no telling whether this (rather weird) function modifies
anything in connection with Drools' Working Memory, global or fact.
Assuming it does, looking at it doesn't help any in locating the
described problem.

-W

On 29/07/2013, Nuwan Bandara <mail.nuwan at gmail.com> wrote:
> When I use the local drools rules instance, object gets updated and
> reflects the changes accordingly but when I use the remote web service call
> to use the remote drools engine, rules get executed correctly but updated
> values does not get reflected back in the return object.
>
>
> Environment into:
>
>
>    - JBoss 5
>    - Uses XLS decision table for the drools rules file
>    - Front end uses jbosseap5 and back-end users JBoss 5
>
>
> Currently I have drools engine running on front end server (referred as
> local) and back-end server (referred as remote) both. When I call the local
> drools engine it works. But when I call the remote server through REST web
> server function get executed correctly but updated values are not in the
> object when it comes back to the front end.
>
> Here’s the function that I use in the decision table (.xls)
>
> function boolean setCTCFlag(Object resultViewMapObj, String siteCode){
>
>         boolean flag = false;
>
>         Map<String, ResultView> resultViewMap = (Map<String, ResultView>)
> resultViewMapObj;
>
>         List<ResultView> resultViewList = new ArrayList<ResultView>();
>
>         resultViewList = new ArrayList<ResultView>
> (resultViewMap.values());
>
>         ResultView resultView = new ResultView();
>
>         resultView = resultViewList.get(0);
>
>         if(resultView.getSampleView().getSample() != null){
>
>             String sampleInd =
> resultView.getSampleView().getSample().getSampleIndicator();
>
>             if(sampleInd != null && sampleInd.length() != 0){
>
>                 String[] sampleIndComp = sampleInd.split(""[^\\w\\s]"");
>
>                 for(int i = 0; i<sampleIndComp.length; i++){
>
>                         LabelValueView labelValueView = new
> LabelValueView();
>
>                         labelValueView.setLabel(sampleIndComp[i].trim());
>
>                         labelValueView.setValue(" ");
>
>                         // DOTO: this is the issue
>
>                         //       folowing line gets executed but changes do
> not get reflected in the object.
>
>                         //       Only happens when this called remotely.
>
>
> resultView.getDynamicFields().put("CTC_CLIENT_FLAG", labelValueView);
>
>                         flag = true;
>
>                 }
>
>             }
>
>         }
>
>         return flag;
>
>     }
>



More information about the rules-users mailing list