wso2esb - local entry as filter criteria in wso2 esb mediation -
i have sequence part of proxy service filters based on "source , regular expression". have defined source element value coming part of soap request , regular expression "local entry defined in esb". however, result not expecting.
local entry defined inline text (myfields) - field1|field2|field3
mediation sequence defined - <sequence xmlns="http://ws.apache.org/ns/synapse" name="007"> <property xmlns:ns="http://org.apache.synapse/xsd" name="fieldname" expression="$body/fieldname/text()" scope="default" type="string"/> <filter xmlns:ns="http://org.apache.synapse/xsd" source="get-property('fieldname')" regex="get-property('myfields')"> <then> <log level="full" separator="*****yes*********"> <property name="myfields" expression="get-property('myfields')"/> </log> </then> <else> <log level="full" separator="*********no**************"> <property name="myfields" expression="get-property('myfields')"/> </log> </else> </filter> </sequence>
when sending soap request - <body> <fieldname>field1</fieldname> </body>
execution going else part. suggestion ?
with filter mediator, regex attribute must string, not expression.
you can use xpath2 "matches"
sample :
<insequence> <property name="force_sc_accepted" value="true" scope="axis2"/> <property name="fieldname" expression="$body/fieldname/text()"/> <property xmlns:fn="http://www.w3.org/2005/xpath-functions" name="match" expression="fn:matches(syn:get-property('fieldname'),syn:get-property('myfields'))"/> <filter source="get-property('match')" regex="true"> <then> <log level="full" separator="*****yes*********"> <property name="myfields" expression="get-property('myfields')"/> </log> </then> <else> <log level="full" separator="*********no**************"> <property name="myfields" expression="get-property('myfields')"/> </log> </else> </filter> <log level="full"/> </insequence>
Comments
Post a Comment