Today the BPEL there is no specific function for us to work directly with Regex (Regular Expression) in BPEL, so I will demonstrate this Post one of the ways we can do to apply a Regex to a process.
In this example we will basically pass a value to our BPEL and will validate these values through the Regex.
For our tests create a project called RegexBpel
Within our Composite.xml add a BPEL Process called RegexBPELProcess
Within your RegexBPELProcess add a Transformation and name it Transform_Regex
Now double-click on your Transform_Regex
In Source add your inputVariable and in Target Variable let your outputVariable and click the + sign to open up the Transformation.
Now connect your input with your result.
Now go in your Source Transformation and add the following line in the declaration of their namespaces.
Now add the code snippet below its <xsl:value-of select=”/client:process/client:input”/>
<xsl:with-param name=”param” select=”/client:process/client:input”/>
Now pull your line <xsl:value-of select=”/client:process/client:input”/>
Then looks like this:
Now add the code snippet below its </xsl:template>
<xsl:value-of select=”strClass:replaceAll($param, ‘[^0-9]’, ”)”/>
See above we are using the replaceAll function, we will take what will be spent on our Input via the variable $param, we will apply the regex [^ 0-9] which will not be allowed to pass any value that is different from the range of numbers from 0 to 9 and finally through the single quotes, say that if there is these values will exchange for nothing, that is, will only pull these values.
Do you now deploy your project and let the tests
Direct in EM (Enterprise Manager) of your BPEL see below I’m going through values
Run and see the Response return:
See that in my response was withdrawn any amount spent different numbers.
Doubts ? Leave your comment and download this Projet
Hugs and see you next