Get URI VAR from SynapseXPath Variable in WSO2 ESB API

I want to get a URI VAR value from request to call correct case in switch in WSO2 ESB API resource, like this:

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

In switch, source="get-property('uri.var.appName')" it's not correct.

Can I get this value using $url SynapseXpath valiables like $url?

Upvotes: 3

Views: 3535

Answers (1)

Ravindra Ranwala
Ravindra Ranwala

Reputation: 21124

What you have done is correct. Please try the same with a log mediator and see whether you get the value properly.

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

Alternatively you can assign this to a property and use that inside your switch mediator.

Upvotes: 6

Related Questions