Reputation: 196
I created an api in wso2ei like this :
<api xmlns="http://ws.apache.org/ns/synapse" name="Test" context="/Test" version="/" version-type="context">
<resource methods="POST" url-mapping="/CheckTest" inSequence="TestSequence">
<outSequence>
<send/>
</outSequence>
</resource>
<resource methods="POST" url-mapping="/TransferTest" inSequence="TestSequence">
<outSequence>
<send/>
</outSequence>
</resource>
</api>
After sending message to sequence i want to get url-mapping value as property. 'To' Action is /Test/CheckTest for CheckTest and /Test/TransferTest for TransferTest. i want to get url-mapping value or resource selected dynamically. how can i do this?
<property name="urlMappingValue" expression=?/>
Upvotes: 0
Views: 48
Reputation: 348
You need to use resource with uri-template , and then access uri part in property through uri.var.
<api xmlns="http://ws.apache.org/ns/synapse" name="Test" context="/Test">
<resource methods="POST" uri-template="/{method}">
<inSequence>
<property name="method" expression="get-property('uri.var.method')" scope="default" type="STRING"/>
<switch source="get-property('uri.var.method')">
<case regex="CheckTest">
... Your logic for Check Test...
</case>
<case regex="TransferTest">
... Your logic for Transfer Test...
</case>
</switch>
</inSequence>
</resource>
</api>
Upvotes: 2