You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在WSO2 Integration Studio中向端点URL注入属性参数?

问题:调用数据服务端点时出现参数不匹配异常

异常信息

[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

序列配置

<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>
</iterate>

数据服务配置

<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>

解决方案

1. 修正属性获取表达式

当前iterate处理的是XML节点,却使用json-eval提取值,会导致uri.var.queryString无法正确获取表名,进而使请求缺少filterQuery参数触发异常。将表达式改为XPath格式:

<property expression="//account/TABLE_NAME/text()" name="uri.var.queryString" scope="default" type="STRING"/>

或使用当前节点上下文表达式:

<property expression="get-property('ctx:current-node')/TABLE_NAME/text()" name="uri.var.queryString" scope="default" type="STRING"/>

2. 修正数据服务参数类型

sqlType="QUERY_STRING"适用于传递完整查询字符串,此处filterQuery是表名(普通字符串),应改为:

<param name="filterQuery" sqlType="STRING"/>

3. 验证参数传递

检查日志中nom字段输出,确认uri.var.queryString已正确获取表名。若仍异常,可在uri-template中硬编码测试表名(如filterQuery=test_table),验证数据服务是否正常响应,排查是参数传递还是数据服务配置问题。


内容的提问来源于stack exchange,提问作者Oussama Nairi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.09 02:15:41