Forum Discussion
electric_Insura
11 years agoContributor
I developed the answer to my question after reviewing a fair amount of Groovy documentation.
The replaceAll method takes a regexp as an argument. The special characters require different handling than if you were using the find method.
There are probably more elegant ways to write this but the code scrubs the CDATA enclosure from outgoing requests just fine.
The solution given here on how to strip a CDATA enclosure http://www.soapui.org/Functional-Testing/working-with-cdata.html#6-an-event-handler-to-the-rescue is the one I used in my initial post - the one that didn't work. It would be great if the docs could be updated.
The replaceAll method takes a regexp as an argument. The special characters require different handling than if you were using the find method.
There are probably more elegant ways to write this but the code scrubs the CDATA enclosure from outgoing requests just fine.
matcher = (context.requestContent =~ /<!\[CDATA\[/)
context.requestContent = matcher.replaceAll("")
matcherdeux = (context.requestContent =~ /\]\]>/)
context.requestContent = matcherdeux.replaceAll("")
The solution given here on how to strip a CDATA enclosure http://www.soapui.org/Functional-Testing/working-with-cdata.html#6-an-event-handler-to-the-rescue is the one I used in my initial post - the one that didn't work. It would be great if the docs could be updated.