I would like to call endpoint using a property value as parameter but it return for me this exception :
[2022-12-14 16:50:22,831] ERROR {DBInOnlyMessageReceiver} - Error in in-only message receiver DS Fault Message: Error in DS non result invoke.
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Nested Exception:-
javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:filterQuery
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
this is my code :
<iterate expression="//accounts/account">
<target>
<sequence>
<property expression="json-eval($.account.TABLE_NAME)" name="uri.var.queryString" scope="default" type="STRING"/>
<log>
<property expression="get-property('uri.var.queryString')" name="nom"/>
</log>
<call>
<endpoint>
<http method="get" uri-template="http://ebs-dev:8290/services/RADMINDataService/altertable?filterQuery={uri.var.queryString}">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>-1</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</http>
</endpoint>
</call>
</sequence>
</target>
Update
this my dataservice config :
<query id="altertable" useConfig="radusage">
<sql>ALTER TABLE :filterQuery ADD COLUMN `numSequence` VARCHAR(20) NULL AFTER `RTCCOST`</sql>
<param name="filterQuery" sqlType="QUERY_STRING"/>
</query>
<resource method="GET" path="altertable">
<call-query href="altertable">
<with-param name="filterQuery" query-param="filterQuery"/>
</call-query>
</resource>
The error you are observing is due to a known issue of MI[1]. When the content type is set in the request it tries to dispatch to the data service operation based on the request body and ignores the URL params. To fix this you can either remove the Content-Type
header as below or send a POST request with the required body to the data service. To do this, you may also need to update your data service configs.
<property name="Content-Type" scope="transport" action="remove"/>
Add the above property just before your call mediator.
<sequence>
<property expression="json-eval($.account.TABLE_NAME)" name="uri.var.queryString" scope="default" type="STRING"/>
<log>
<property expression="get-property('uri.var.queryString')" name="nom"/>
</log>
<property name="Content-Type" scope="transport" action="remove"/>
<call>
<endpoint>
<http method="get" uri-template="http://ebs-dev:8290/services/RADMINDataService/altertable?filterQuery={uri.var.queryString}">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>-1</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</http>
</endpoint>
</call>
</sequence>