I am using WSO2 ESB 4.8.1. I need to check if a specific field exists in the incoming payload XML document. If Iit does, the switch case should be run, otherwise it should run the default script. The field I'm checking on will always have a dynamic value, and it will look like this:
20000569899
I wrote the following logic in ESB:
<property name="CheckIdExist" expression="//*[local-name()='Id']" scope="default" type="STRING" description="CheckIdExist"/>
<switch source="get-property('CheckIdExist')">
<case regex="[a-zA-Z0-9]">
<sequence key="SequenceA"/>
<sequence key="SequenceB"/>
<sequence key="SequenceC"/>
</case>
<default>
<log></log>
</default>
</switch>
Problem:
The problem is that Switch can select a value from the property, but does not match the Case regular expression. The following are some ESB log entries:
Log entries:
XPath : get-property('CheckIdExist') evaluates to : 20001089900
None of the switch cases matched - executing default
, . , WSO2 ESB . , , , , .