我想从请求中获取一个URI VAR值,以调用WSO2 ESB API资源中交换机中的正确案例,如下所示:
<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有效值来获得这个值吗?
您所做的是正确的。请对日志中介器进行同样的尝试,看看您是否正确地获得了值。
<log level="custom">
<property name="AppName" expression="get-property('uri.var.appName')"/>
</log>
或者,您可以将其分配给一个属性,并在切换中介中使用该属性。