Tuesday, February 14, 2012

Using Search and Replace with the Vordel Gateway

Recently I set up a simple Search and Replace policy using the Vordel Gateway. Here is how I configured this. For the purposes of this blog post, I'm replacing the text "Monday" with "Tuesday".

The string replacement is achieved in a small number of filters, and the main work (the actual search and replace) is done in the "String Replace" filter. Let's look at this in action:

Starting from the top, I am using a "Retrieve from Message" filter to read the whole message into a variable, which I'm calling "ReplacementExample". I am reading the entire message, using a "/" XPath Expression.





Next, here is where I am using the "String Replace" filter, to simply replace the text "Monday" with "Tuesday". You can see that if I wanted to use a Regular Expression for a more complex scenario, I could configure this here too.

Finally we see the policy in action. I'm using the free SOAPbox tool as the client. You can see that the day information in the message is automatically replaced by the "String Replace" filter.