Question

I'm using the WSO2 ESB and DSS, I have setup a DSS service and have tested this and it works using the following URL

http://10.248.40.85:9764/services/params/op/{Value goes here}

My problem is when calling this from the ESB it doesn't work and throws the incompatible parameters error. The way it is being called is as follows

<log level="custom">
    <property name="uri.var.ID" expression="$body/int:User/int:UserID/text()"/>
</log>
<send>
    <endpoint>
        <http method="get" uri-template="http://10.248.40.85:9764/services/params/op/{uri.var.ID}"/>
    </endpoint>
</send>

When logging the uri.var.ID it returns the expected number but when the service tries to call the endpoint it throws the error and says that the current parameters are empty.

The DSS service resource is

<resource method="GET" path="op/{ID}">
    <call-query href="query2">
        <with-param name="ID" query-param="ID"/>
    </call-query>
</resource>
Was it helpful?

Solution 2

Solved the problem by using the following

<payloadFactory media-type="xml">
    <format>
        <p:operation2 xmlns:p="http://ws.wso2.org/dataservice">
            <xs:ID xmlns:xs="http://ws.wso2.org/dataservice">$1</xs:ID>
        </p:operation2>
    </format>
    <args>
        <arg xmlns:xs="http://ws.wso2.org/dataservice" xmlns:ns="http://org.apache.synapse/xsd" evaluator="xml" expression="get-property('uri.var.ID')"/>
    </args>
</payloadFactory>
<call>
    <endpoint>
        <address uri="http://10.248.40.85:9764/services/params/operation2"/>
    </endpoint>
</call>

OTHER TIPS

This issue can be occur due to some various reasons. so checklist as below.

  1. Payload from ESB to Dss (Client -> ESB-> DSS) is not in expected strcuture.
  2. calling wrong port.
  3. you are not calling the correct DSS Service from the ESB.

Latest Version of DSS Supports default parameter values in the query param list. Could you please give a try by adding defaultValue="#{NULL}" in query param list in your data service (dbs) file?

<query id="QUERY-ID" useConfig="DATA-SOURCE-ID">
    <sql>-------------SQL QUERY HERE -----</sql>
    <result ----------- >
        <element ------------ />  
    </result>
    <param defaultValue="#{NULL}" name="PARAM-NAME" ordinal="1" sqlType="INTEGER"/>
</query>

The issue should be you have defined the property uri.var.ID inside the log mediator. Define it outside and check.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top