WSO2 EI: DS Fault Message: Error in ‘CallQuery.extractParams’

I have a data service exposed as a REST resource that inserts data into a MySQL table. When I call this resource directly from postman, it inserts the data successfully. However, when I call it via an endpoint it gives the following error:

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:firstName
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Source Data Service:-
Name: CustomerDataService
Location: /Applications/IntegrationStudio.app/Contents/Eclipse/runtime/microesb/tmp/carbonapps/-1234/1657777407345TestCompositeApplication_1.0.0.car/CustomerDataService_1.0.0/CustomerDataService-1.0.0.dbs
Description: 
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: _getcustomer_firstname
Current Params: {}


    at org.wso2.micro.integrator.dataservices.core.dispatch.SingleDataServiceRequest.processSingleRequest(SingleDataServiceRequest.java:117)
    at org.wso2.micro.integrator.dataservices.core.dispatch.SingleDataServiceRequest.processRequest(SingleDataServiceRequest.java:66)
    at org.wso2.micro.integrator.dataservices.core.dispatch.DataServiceRequest.dispatch(DataServiceRequest.java:358)
    at org.wso2.micro.integrator.dataservices.core.DataServiceProcessor.dispatch(DataServiceProcessor.java:40)
    at org.wso2.micro.integrator.dataservices.core.DBInOnlyMessageReceiver.invokeBusinessLogic(DBInOnlyMessageReceiver.java:52)
    at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
    at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:375)
    at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:189)
    at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:firstName
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Source Data Service:-
Name: CustomerDataService
Location: /Applications/IntegrationStudio.app/Contents/Eclipse/runtime/microesb/tmp/carbonapps/-1234/1657777407345TestCompositeApplication_1.0.0.car/CustomerDataService_1.0.0/CustomerDataService-1.0.0.dbs
Description: 
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: _getcustomer_firstname
Current Params: {}

    at org.wso2.micro.integrator.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:100)
    at org.wso2.micro.integrator.dataservices.core.engine.DSOMDataSource.serialize(DSOMDataSource.java:105)
    at org.wso2.micro.integrator.dataservices.core.engine.DSOMDataSource.executeInOnly(DSOMDataSource.java:78)
    at org.wso2.micro.integrator.dataservices.core.dispatch.SingleDataServiceRequest.processSingleRequest(SingleDataServiceRequest.java:115)
    ... 12 more
Caused by: DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:firstName
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Source Data Service:-
Name: CustomerDataService
Location: /Applications/IntegrationStudio.app/Contents/Eclipse/runtime/microesb/tmp/carbonapps/-1234/1657777407345TestCompositeApplication_1.0.0.car/CustomerDataService_1.0.0/CustomerDataService-1.0.0.dbs
Description: 
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: _getcustomer_firstname
Current Params: {}

    at org.wso2.micro.integrator.dataservices.core.engine.CallQuery.extractParams(CallQuery.java:337)
    at org.wso2.micro.integrator.dataservices.core.engine.CallQuery.executeElement(CallQuery.java:278)
    at org.wso2.micro.integrator.dataservices.core.engine.OutputElement.execute(OutputElement.java:88)
    at org.wso2.micro.integrator.dataservices.core.description.resource.Resource.execute(Resource.java:66)
    at org.wso2.micro.integrator.dataservices.core.engine.DataService.invoke(DataService.java:613)
    at org.wso2.micro.integrator.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:94)
    ... 15 more

[2022-07-14 11:13:54,166] ERROR {ServerWorker} - Error processing GET request for : /services/CustomerDataService.HTTPEndpoint/customer/John org.apache.axis2.AxisFault: 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:firstName
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Source Data Service:-
Name: CustomerDataService
Location: /Applications/IntegrationStudio.app/Contents/Eclipse/runtime/microesb/tmp/carbonapps/-1234/1657777407345TestCompositeApplication_1.0.0.car/CustomerDataService_1.0.0/CustomerDataService-1.0.0.dbs
Description: 
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: _getcustomer_firstname
Current Params: {}


    at org.wso2.micro.integrator.dataservices.core.DBUtils.createAxisFault(DBUtils.java:814)
    at org.wso2.micro.integrator.dataservices.core.DBInOnlyMessageReceiver.invokeBusinessLogic(DBInOnlyMessageReceiver.java:57)
    at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
    at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:375)
    at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:189)
    at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:firstName
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Source Data Service:-
Name: CustomerDataService
Location: /Applications/IntegrationStudio.app/Contents/Eclipse/runtime/microesb/tmp/carbonapps/-1234/1657777407345TestCompositeApplication_1.0.0.car/CustomerDataService_1.0.0/CustomerDataService-1.0.0.dbs
Description: 
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: _getcustomer_firstname
Current Params: {}

    at org.wso2.micro.integrator.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:100)
    at org.wso2.micro.integrator.dataservices.core.engine.DSOMDataSource.serialize(DSOMDataSource.java:105)
    at org.wso2.micro.integrator.dataservices.core.engine.DSOMDataSource.executeInOnly(DSOMDataSource.java:78)
    at org.wso2.micro.integrator.dataservices.core.dispatch.SingleDataServiceRequest.processSingleRequest(SingleDataServiceRequest.java:115)
    at org.wso2.micro.integrator.dataservices.core.dispatch.SingleDataServiceRequest.processRequest(SingleDataServiceRequest.java:66)
    at org.wso2.micro.integrator.dataservices.core.dispatch.DataServiceRequest.dispatch(DataServiceRequest.java:358)
    at org.wso2.micro.integrator.dataservices.core.DataServiceProcessor.dispatch(DataServiceProcessor.java:40)
    at org.wso2.micro.integrator.dataservices.core.DBInOnlyMessageReceiver.invokeBusinessLogic(DBInOnlyMessageReceiver.java:52)
    ... 8 more
Caused by: DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:firstName
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Source Data Service:-
Name: CustomerDataService
Location: /Applications/IntegrationStudio.app/Contents/Eclipse/runtime/microesb/tmp/carbonapps/-1234/1657777407345TestCompositeApplication_1.0.0.car/CustomerDataService_1.0.0/CustomerDataService-1.0.0.dbs
Description: 
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: _getcustomer_firstname
Current Params: {}

    at org.wso2.micro.integrator.dataservices.core.engine.CallQuery.extractParams(CallQuery.java:337)
    at org.wso2.micro.integrator.dataservices.core.engine.CallQuery.executeElement(CallQuery.java:278)
    at org.wso2.micro.integrator.dataservices.core.engine.OutputElement.execute(OutputElement.java:88)
    at org.wso2.micro.integrator.dataservices.core.description.resource.Resource.execute(Resource.java:66)
    at org.wso2.micro.integrator.dataservices.core.engine.DataService.invoke(DataService.java:613)
    at org.wso2.micro.integrator.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:94)
    ... 15 more

The endpoint that calls the data service REST resource:

<?xml version="1.0" encoding="UTF-8"?>
<endpoint name="CreateCustomerInDB" xmlns="http://ws.apache.org/ns/synapse">
    <http method="get" uri-template="http://localhost:8290/services/CustomerDataService.HTTPEndpoint/customer/{uri.var.firstName}">
        <suspendOnFailure>
            <initialDuration>-1</initialDuration>
            <progressionFactor>1.0</progressionFactor>
        </suspendOnFailure>
        <markForSuspension>
            <retriesBeforeSuspension>0</retriesBeforeSuspension>
        </markForSuspension>
    </http>
</endpoint>

The data service:

<data name="CustomerDataService" serviceNamespace="" serviceGroup="" transports="">
  <description />
  <config id="CustomerDatasource">
    <property name="driverClassName">com.mysql.cj.jdbc.Driver</property>
    <property name="url">jdbc:mysql://localhost:3306/demopresentation</property>
    <property name="username">root</property>
    <property name="password" />
  </config>
  <query id="CreateCustomerEntry" useConfig="CustomerDatasource">
    <sql>insert into customers (FirstName) values (:firstName)</sql>
    <param name="firstName" paramType="SCALAR" sqlType="STRING" type="IN" />
  </query>
   <resource path="customer/{firstName}" method="GET">
      <call-query href="CreateCustomerEntry"          >
         <with-param name="firstName" query-param="firstName" />
      </call-query>
   </resource>
</data>

Leave a Comment