Following is how you can read query params from your rest service when using Enterprise Integrator.
There are two ways to read your query params.
1. Assigning value to a property within a URI template. (get-property('uri.var.qtest')).
If you look at the following synapse config I'm assigning the required query param to
<api xmlns="http://ws.apache.org/ns/synapse" name="test" context="/qtest"> <resource methods="GET" uri-template="/search?q={qtest}" outSequence="" faultSequence=""> <inSequence> <log> <property name="QUERY PARAM IS =" expression="get-property('uri.var.qtest')"/> </log> </inSequence> </resource> </api>
2. Reading as a query params. (get-property('query.param.q'))
By default query params are loaded by the EI it self, so you can directly access them without any extra configurations. Following is how you can do this.
<api xmlns="http://ws.apache.org/ns/synapse" name="test" context="/qtest"> <resource methods="GET" uri-template="/search?q=*" outSequence="" faultSequence=""> <inSequence> <log> <property name="QUERY PARAM IS =" expression="get-property('query.param.q')"/> </log> </inSequence> </resource> </api>
Please drop a comment if you have any further queries.
0 comments:
Post a Comment