从WSO2 ESB API中的SynapseXPath变量获取URI VAR

时间:2015-06-26 08:43:13

标签: wso2 wso2esb

我想从请求中获取URI VAR值,以便在WSO2 ESB API资源的switch中调用正确的大小写,如下所示:

<api name="apk" context="/apk"><resource methods="GET" uri-
template="/apk/{appName}"><inSequence><header name="App" 
scope="transport" action="remove"/><switch source="get-
property('uri.var.appName')"><case regex="BEBE"><send><endpoint><http 
method="GET" uri-template="http://localhost/apk/Bebe.apk></http>
</endpoint></send></case><case regex="CITAS"><send><endpoint><http 
method="GET" uri-template="http://localhost/apk/Citas.apk></http>
</endpoint></send></case></switch></inSequence></resource></api>

在切换中,source="get-property('uri.var.appName')"它不正确。

我可以使用像$url这样的$url SynapseXpath算法来获取此值吗?

1 个答案:

答案 0 :(得分:5)

你所做的是正确的。请尝试使用日志中介,并查看您是否正确获得该值。

<log level="custom">
    <property name="AppName" expression="get-property('uri.var.appName')"/>
</log>

或者,您可以将其分配给属性并在交换机调解器中使用它。

相关问题