Extracting JSON content from CDATA in SOAP Response
<p>I am working on SoapUI where I have a Soap request which takes input in Json String format and after the processing I get a Soap Response in XML with JSON format enclosed in CDATA.</p>

<p>I am trying to extract the data from Soap Response using the below code but I get error "Content is not allowed in prolog"</p>

<pre><code>import com.eviware.soapui.support.XmlHolder
import net.sf.json.groovy.JsonSlurper
import groovy.xml.Namespace

respXmlHolder = new XmlHolder(messageExchange.getResponseContentAsXml())
respXmlHolder.declareNamespace("ns1","http://tempuri.org/")
CDATAXml = respXmlHolder.getNodeValue("//ns1:ReportResult")
log.info(CDATAXml)


def data = new XmlParser().parseText(CDATAXml).Rpt
log info "data.findAll{it.'Name'}.size()"
</code></pre>

<p>The Soap Response looks this way as shown below:</p>

<pre><code>&lt;ReportResponse xmlns="http://tempuri.org/"&gt;
     &lt;ReportResult&gt;&lt;![CDATA[{
  "Report": [
    {
      "Name": "ABC",
      "Number": "123",
      "Type": "XYZ",
      "Desc": "EFGH",
      "Group Name": "Name123",
      "Group Number": "123",
      "End Date": "12/30/2014",
      "Due Date": "04/15/2015",
      "Completion Date": null,
      "Status": "Status1",
      "Received Date": "",
      "Delivery Date": "",
      "Location": "",
      "Role": "",
     },
     {
      "Name": "EFG",
       "Number": "123",
      "Type": "XYZ",
      "Desc": "EFGH",
      "Group Name": "Name123",
      "Group Number": "123",
      "End Date": "12/30/2014",
      "Due Date": "04/15/2015",
      "Completion Date": null,
      "Status": "Status1",
      "Received Date": "",
      "Delivery Date": "",
      "Location": "",
      "Role": "Manager",
     }
    ]
} ]]&gt;&lt;/ReportResult&gt;
  &lt;/ReportResponse&gt;
   &lt;/s:Body&gt;
&lt;/s:Envelope&gt;
</code></pre>

<p>Please help me in this regard.</p>