How to read query param in WSO2 ESB 4.8 or above?

流过昼夜 提交于 2019-12-01 06:02:19

问题


I have a rest end point in WSO2ESB (4.8),I need to read query parameter to set as dynamic payload as the my business ,But i failed to read it due to newer with wso2 ESB.Any help ?


回答1:


The bellow code may help you

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



回答2:


Define a REST API inside ESB and access to query params with get-property('query.param.xxx') or get-property('uri.var.yyy'), sample :

<resource methods="GET" uri-template="/testwso2/{symbol}?arg1={value1}">

get-property('query.param.arg1')
get-property('uri.var.symbol')


来源:https://stackoverflow.com/questions/27295902/how-to-read-query-param-in-wso2-esb-4-8-or-above

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!