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

Ser*_*lvo 3 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>
Run Code Online (Sandbox Code Playgroud)

在开关中,source="get-property('uri.var.appName')"它是不正确的.

我可以使用$urlSynapseXpath 这样的值来获得这个值$url吗?

Rav*_*ala 6

你所做的是正确的.请尝试使用日志介体,看看您是否正确获得了值.

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

或者,您可以将其分配给属性并在切换介体中使用它.