I start with:
<?xml version="1.0" encoding="UTF-8"?>
<api context="/echo/2" name="echo" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET" uri-template="/{echoque}">
<inSequence/>
<outSequence/>
<faultSequence/>
</resource>
</api>
And I can log echoque with get-property("uri.var.echoque"), aslo $ctx:uri.var.echoque, but if I set the value to literal, it works, so I don know how to use the uri template from... here is my last example
<?xml version="1.0" encoding="UTF-8"?>
<api context="/echo/sound" name="echo" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET" uri-template="/{echoque}">
<inSequence>
<log>
<property expression="get-property("uri.var.echoque")" name="Input"/>
</log>
<call>
<endpoint>
<http method="get" uri-template="http://echotest.localhost/echo/{uri.var.sound}">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>-1</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</http>
<property expression="$ctx:uri.var.echoque" name="uri.var.sound"/>
</endpoint>
</call>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
Can someone explain how to use the variables from the rest api? I also tryed paylodfactory using a json tyle { "input: $1 } and use it like json: $.input but no...
The following should work. You don't have to use a separate variable. Directly use the
uri.var.echoque
inside the call mediator.