title: ESB 4.6.0 with Data server plugin - Not able to execute stored procedure with REF_CURSOR
body: <p>I am working on MAC OS X - 10.7.5 with WSO2 ESB 4.6.0 and Data Service feature - 4.0.5</p>
  
  <p>Java java version "1.6.0_37"
  Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-11M3909)
  Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode)</p>
  
  <p>I am trying to execute stored procedure with ref cursor.</p>
  
  <p>Here is my DS</p>
  
  <pre><code>&lt;data name="RZM"&gt;
     &lt;config id="RZS_Data"&gt;
        &lt;property name="driverClassName"&gt;oracle.jdbc.driver.OracleDriver&lt;/property&gt;
        &lt;property name="url"&gt;XXXX&lt;/property&gt;
        &lt;property name="username"&gt;XXXX&lt;/property&gt;
        &lt;property name="password"&gt;XXXX&lt;/property&gt;
        &lt;property name="defaultTransactionIsolation"&gt;TRANSACTION_READ_COMMITTED&lt;/property&gt;
     &lt;/config&gt;
     &lt;query id="TEST" useConfig="RZS_Data"&gt;
        &lt;sql&gt;call RT_PROC_GET_VERSION(:in_app_id,:in_version_id,?,?,?)&lt;/sql&gt;
        &lt;result element="Results" rowName="Result"&gt;
           &lt;element column="app_url" name="app_url" optional="true" xsdType="string"/&gt;
           &lt;element column="out_message" name="OutMessage" optional="true" xsdType="string"/&gt;
           &lt;element column="out_err_message" name="out_err_message" optional="true" xsdType="string"/&gt;
        &lt;/result&gt;
        &lt;param name="in_app_id" ordinal="1" sqlType="INTEGER" type="INOUT"/&gt;
        &lt;param name="in_version_id" ordinal="2" sqlType="STRING" type="INOUT"/&gt;
        &lt;param name="compare_from_id" ordinal="3" paramType="ARRAY" sqlType="ORACLE_REF_CURSOR" type="OUT"/&gt;
        &lt;param name="out_message" ordinal="4" sqlType="STRING" type="OUT"/&gt;
        &lt;param name="out_err_message" ordinal="5" sqlType="STRING" type="OUT"/&gt;
     &lt;/query&gt;
     &lt;operation name="TOP"&gt;
        &lt;call-query href="TEST"&gt;
           &lt;with-param name="in_app_id" query-param="in_app_id"/&gt;
           &lt;with-param name="in_version_id" query-param="in_version_id"/&gt;
        &lt;/call-query&gt;
     &lt;/operation&gt;
  &lt;/data&gt;
  </code></pre>
  
  <p>I am getting following error all the time</p>
  
  <pre><code>[2013-02-14 18:00:14,400] ERROR - DataService DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:in_version_id
  DS Code: INCOMPATIBLE_PARAMETERS_ERROR
  Source Data Service:-
  Name: RZM
  Location: /RZM.dbs
  Description: N/A
  Default Namespace: http://ws.wso2.org/dataservice
  Current Request Name: TOP
  Current Params: {}
  
  DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:in_version_id
  DS Code: INCOMPATIBLE_PARAMETERS_ERROR
  Source Data Service:-
  Name: RZM
  Location: /RZM.dbs
  Description: N/A
  Default Namespace: http://ws.wso2.org/dataservice
  Current Request Name: TOP
  Current Params: {}
  
      at org.wso2.carbon.dataservices.core.engine.CallQuery.extractParams(CallQuery.java:208)
      at org.wso2.carbon.dataservices.core.engine.CallQuery.executeElement(CallQuery.java:177)
      at org.wso2.carbon.dataservices.core.engine.CallQueryGroup.executeElement(CallQueryGroup.java:111)
      at org.wso2.carbon.dataservices.core.engine.OutputElement.execute(OutputElement.java:89)
      at org.wso2.carbon.dataservices.core.description.operation.Operation.execute(Operation.java:71)
      at org.wso2.carbon.dataservices.core.engine.DataService.invoke(DataService.java:548)
      at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:99)
      at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.serialize(DSOMDataSource.java:110)
      at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:691)
      at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:562)
      at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:875)
      at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:283)
      at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:245)
      at org.apache.axiom.om.impl.llom.OMSerializableImpl.serializeAndConsume(OMSerializableImpl.java:193)
      at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:74)
      at org.apache.synapse.transport.passthru.PassThroughHttpSender.submitResponse(PassThroughHttpSender.java:435)
      at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:227)
      at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
      at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:45)
      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.processEntityEnclosingRequest(ServerWorker.java:434)
      at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:219)
      at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:680)
  [2013-02-14 18:00:14,402] ERROR - PassThroughHttpSender Failed to submit the response
  org.apache.axis2.AxisFault: DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:in_version_id
  DS Code: INCOMPATIBLE_PARAMETERS_ERROR
  Source Data Service:-
  Name: RZM
  Location: /RZM.dbs
  Description: N/A
  Default Namespace: http://ws.wso2.org/dataservice
  Current Request Name: TOP
  Current Params: {}
  
      at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
      at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:78)
      at org.apache.synapse.transport.passthru.PassThroughHttpSender.submitResponse(PassThroughHttpSender.java:435)
      at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:227)
      at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
      at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:45)
      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.processEntityEnclosingRequest(ServerWorker.java:434)
      at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:219)
      at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:680)
  Caused by: javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:in_version_id
  DS Code: INCOMPATIBLE_PARAMETERS_ERROR
  Source Data Service:-
  Name: RZM
  Location: /RZM.dbs
  Description: N/A
  Default Namespace: http://ws.wso2.org/dataservice
  Current Request Name: TOP
  Current Params: {}
  
      at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:105)
      at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.serialize(DSOMDataSource.java:110)
      at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:691)
      at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:562)
      at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:875)
      at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:283)
      at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:245)
      at org.apache.axiom.om.impl.llom.OMSerializableImpl.serializeAndConsume(OMSerializableImpl.java:193)
      at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:74)
      ... 12 more
  [2013-02-14 18:00:14,403] ERROR - ServerWorker Error processing POST request for : /services/RZM.SOAP12Endpoint/TOP
  org.apache.axis2.AxisFault: Failed to submit the response
      at org.apache.synapse.transport.passthru.PassThroughHttpSender.handleException(PassThroughHttpSender.java:496)
      at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:229)
      at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
      at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:45)
      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.processEntityEnclosingRequest(ServerWorker.java:434)
      at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:219)
      at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:680)
  Caused by: org.apache.axis2.AxisFault: DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:in_version_id
  DS Code: INCOMPATIBLE_PARAMETERS_ERROR
  Source Data Service:-
  Name: RZM
  Location: /RZM.dbs
  Description: N/A
  Default Namespace: http://ws.wso2.org/dataservice
  Current Request Name: TOP
  Current Params: {}
  
      at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
      at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:78)
      at org.apache.synapse.transport.passthru.PassThroughHttpSender.submitResponse(PassThroughHttpSender.java:435)
      at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:227)
      ... 10 more
  Caused by: javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:in_version_id
  DS Code: INCOMPATIBLE_PARAMETERS_ERROR
  Source Data Service:-
  Name: RZM
  Location: /RZM.dbs
  Description: N/A
  Default Namespace: http://ws.wso2.org/dataservice
  Current Request Name: TOP
  Current Params: {}
  
      at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:105)
      at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.serialize(DSOMDataSource.java:110)
      at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:691)
      at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:562)
      at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:875)
      at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:283)
      at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:245)
      at org.apache.axiom.om.impl.llom.OMSerializableImpl.serializeAndConsume(OMSerializableImpl.java:193)
      at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:74)
      ... 12 more
  </code></pre>
  
  <p>I am not sure why I get this error. I am trying to execute DS with "TryIt" service. Input XML is  following </p>
  
  <pre><code>&lt;body&gt;
     &lt;p:TOP xmlns:p="http://ws.wso2.org/dataservice"&gt;
        &lt;!--Exactly 1 occurrence--&gt;
        &lt;p:in_app_id&gt;1296&lt;/p:in_app_id&gt;
        &lt;!--Exactly 1 occurrence--&gt;
        &lt;p:in_version_id&gt;2.2&lt;/p:in_version_id&gt;
     &lt;/p:TOP&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>The stored procedure definition starts with following</p>
  
  <pre><code>     create or replace procedure RT_PROC_GET_VERSION (in_app_id                in number,
                                                      in_version_id           in varchar2,
                                                      out_version_detail      out sys_refcursor,
                                                      out_message             out varchar2,
                                                      out_err_message         out varchar2)
      is
      begin
              open out_version_detail for
              select
                      app_url, switch_board_url, version
  .
  .
  
  end RT_PROC_GET_VERSION;
  </code></pre>
  
  <p>Can you please help?
  thanks
  Abhijit</p>