Forum Discussion
Sphujidhwaj
Contributor
As mentioned in the first post this is the XML Response ouput.
<ReportResponse xmlns="http://tempuri.org/"> <ReportResult><![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", },
When I try extracting the names using script assertion.
I get error Content is not allowed in Prolog.
In the preceding post, I had pasted the output from SoapUI sorry for the confusion.
Thanks,
SD
Sphujidhwaj
9 years agoContributor
def alert = com.eviware.soapui.support.UISupport; def inputFile = new File("C:\\Test.xml") if(!inputFile.exists()) { alert.showInfoMessage("Input File 'Test.xml' not found!"); } else { def InputXML = new XmlParser().parseText(inputFile.text) def InputRow = InputXML.ReportResult.findAll{it.'Group Name'.text().size() } InputRow.each{log.info(it.'Group Name'.text()); } }
I have tried the above code but I get result as - Script-result: []
Let me know where I am going wrong.
Note: The Test.xml contains the Soap Response with data enclosed in CDATA
Thanks,
SD
- Sphujidhwaj9 years agoContributorHow do I extract the JSON part from CDATA?? Please help.
- nmrao9 years agoChampion Level 3Have you looked at the links provide earlier in Message #5?
- Sphujidhwaj9 years agoContributor
Yes , I tried but not able to get the data. I am encountering a message Content is not allowed in prolog.
How to convert the Part of response in Soap to Json ?
- nmrao9 years agoChampion Level 3I believe, you did mention this earlier too if I remember.
May be there must be some issue with the xml that you receive. You can search on the net for that error. - Sphujidhwaj9 years agoContributor
There is no issue with the XML here this service is being called by the component and processed without any error.