Search code examples
proxywso2conditional-statementsmediatorwso2-esb

WSO2 Filter Proxy Boolean Expression evaluator issue


in my proxy i'm using a filter mediator. My target is to activate a sequence if some conditions on some properties are verified:

codice = 0 idElementoCross is different from null or empty string or if it exists tipoElementoCross is different from null or empty string or if it exists

i wrote this condition:

 <sequence>
     <property name="codice" expression="//codice"></property>
     <property name="idElementoCross" expression="//idElementoCross"></property>
     <property name="tipoElementoCross" expression="//tipoElementoCross"></property>
     <filter xpath="boolean(fn:get-property('codice')=0 and fn:get-property('tipoRisposta')='worker' and fn:get-property('tipoElementoCross')!='null' and fn:get-property('idElementoCross')!='null' and fn:get-property('tipoElementoCross')!='' and fn:get-property('idElementoCross')!='' and fn:get-property('tipoElementoCross') and fn:get-property('idElementoCross'))">
                 <then> ...

but in my log i see that esb enter the sequence even if idElementoCross and tipoElementoCross are empty. Im using WSO2 ESB 4.8.1.

What am i missing?


Solution

  • This is because when there is no value, //tipoElementoCross return the node and not the text value :

    send <tipoElementoCross></tipoElementoCross>

    //tipoElementoCross = <tipoElementoCross></tipoElementoCross>

    //tipoElementoCross/text() =