Search code examples
javarestdroolsredhat-brms

Error calling drools REST API with data object contains a list


I'm running into an issue where I'm trying to call drools using the REST API and as part of my layload I'm passing the main data object, plus a 2nd data object which will be my response object. So, the idea is to have an empty response object in working memory that I can update. My XML looks something like this:

<batch-execution lookup="defaultStatelessKieSession">
<insert out-identifier="RequestData" return-object="true" entry-point="DEFAULT">
    <com.test.package.RequestData>
        <fieldOne>ValueOne</fieldOne>
        <fieldTwo>ValueTwo</fieldTwo>
        <fieldThree>ValueThree</fieldThree>
    </com.test.package.RequestData>
</insert>
<insert out-identifier="ResponseData" return-object="false" entry-point="DEFAULT">
    <com.test.package.ResponseData>
        <ruleResults></ruleResults>
        <responseList></responseList>
    </com.test.package.ResponseData>
</insert>
<fire-all-rules />
<query name="rulesResponses" out-identifier="rulesResponses" />
</batch-execution>

Where, in my data object "responseList" is defined as:

private java.util.List<java.lang.String> responseList

Because it's defined as a list I get the following error trying to call the API:

<org.kie.server.api.model.ServiceResponse>
<type>FAILURE</type>
<msg>Error calling container TestContainer: No such field com.test.package.ResponseData.responseList
</org.kie.server.api.model.ServiceResponse>

So, my question is....

How do I properly represent my List attribute in the request payload so that it properly instantiates the response object instead of throwing this error?

Any help would be greatly appreciated.

Thanks.


Solution

  • This is no longer an issue as we have gone a different route.

    Marking question as answered.