我在WSO2ESB(4.8)中有一个休息终点,我需要读取查询参数以将动态有效负载设置为我的业务,但由于更新的wso2 ESB.Any帮助,我无法读取它?
波纹管代码可以帮助您
<api xmlns="http://ws.apache.org/ns/synapse" name="sample" context="/api/sample">
<resource methods="OPTIONS GET" uri-template="/{val1}/groups/{val2}.json?q1={v1}&q2={v2}">
<inSequence>
<property name="uri.var.q1" expression="$url:q1"></property>
<property name="uri.var.q2" expression="$url:q2"></property>
<property name="uri.var.val1" expression="get-property('uri.var.val1')"></property>
<property name="uri.var.val2" expression="get-property('uri.var.val2')"></property>
<send>
<endpoint>
<http method="GET" uri-template=""></http>
</endpoint>
</send>
</inSequence>
<outSequence>
<send></send>
</outSequence>
</resource>
</api>
Run Code Online (Sandbox Code Playgroud)
小智 5
在 ESB 中定义 REST API 并使用 get-property('query.param.xxx') 或 get-property('uri.var.yyy') 访问查询参数,示例:
<resource methods="GET" uri-template="/testwso2/{symbol}?arg1={value1}">
get-property('query.param.arg1')
get-property('uri.var.symbol')
Run Code Online (Sandbox Code Playgroud)