I have a SOAP request which returns the complete response in CDATA. I am trying to convert it to XML using the RequestFilter.filterRequest event handler. But it is not working. The response is still coming back as CDATA. I am using the following help document (which is no help at all obviously)...
def content = context.httpResponse.responseContent
content = content.replaceAll("<![CDATA[<QuoteObject>", "")
content = content.replaceAll( "]]>", "")
log.info( content )
context.httpResponse.responseContent = content
So, here is part of my request and response in the CData format ...
I would like the response to be displayed in the xml format.
If not possible, is there an easy way to write assertions for the data returning in the CData format?
I couldn't find anything except 'Contains' assertion. I would like to use XPath.
<CalculateQuoteResult><![CDATA[<QuoteObject><Insured UnitNumber=""><Quote UnitNumber=""><EffectiveDate>08/10/2011</EffectiveDate>
Thanks for the information Rao.
The script was really simple, and works fine!
def rootNode = new XmlSlurper().parseText('My CData Text')
assert rootNode.name() == 'The Root node in my CData'
assert rootNode.State.text() == AZ (State being one of the nodes in the CData).