Event Handler To Remove CDATA In Response Doesn't Work? soapui.org/../working-with-cdata.html
Hi
groovyguy's been helping me out with some CDATA troubles and I've been doing some reading and I've found a page in the soapui.org page that indicates you can create an event handler to remove the CDATA heading (doesn't remove the XML contained within the CDATA header) in the SOAP response XML.
The page is https://www.soapui.org/functional-testing/working-with-cdata.html
and the relevant detail is in section '6. An Event Handler To The Rescue'
Within the section it states to select the 'Events' option, select the 'RequestFilter.afterRequest' type, Event = RequestFilter.afterRequest
The script on the page is as follows:
def content = context.httpResponse.responseContent content = content.replaceAll( "<!\\[CDATA\\[", "" ) content = content.replaceAll( "]]>", "" ) //log.info( content ) context.httpResponse.responseContent = content
I submitted the request expecting (desperately hoping) that the CDATA fragment would be removed and the tags within the CDATA would be split out into separate tags rather than a single string (like what the page indicates) but no luck - the tags all remain a single string within the CDATA.
Could anyone advise?
I've added a screenshot so you can see the Event Handler and the response XML
Many thanks,
richie