Forum Discussion

spslash10's avatar
spslash10
New Contributor
14 years ago

XML parser

Hi,

I am new to SoapUI. My requirement is to parse a large xml response from soap UI and compare values with another xml for automation of webservices.
Please suggest which parser should I use and how to implement it. The response has multiples namespaces too.

Please help.. it is urgent
  • spslash10's avatar
    spslash10
    New Contributor
    Thank you for the response. I want to brief about the scenario.
    I am using Soap UI. I have a test case having reqest to a webservice which returns me soap response xml. I capture this response, parse the XML and process this xml further. For parsing I use this code:

    def holder = groovyUtils.getXmlHolder( "Request 1#Response" )
    holder.namespaces["a"] = "http://abc.xyz"
    def node = holder.getNodeValue( "//a:<element1>[1]/a:<child elt>[1]/b:someInfo[1]/@i:nil" )

    By passing "Request 1#Response" to getXmlHolder(), it captures soap response and make it available to holder.
    But now I want to use Slurper. I see the slurper can be used to parse an xml.

    def records = new XmlSlurper().parseText(........)

    Here the parse text method accepts either plain text /FileObject/ inputstream etc.
    In order to use XML slurper, I have to pass soap response to this method above.
    Please suggest how do I pass Soap response dynamically coming from webservice and pass it for comparison using Slurper method.

    or IN OTHER WORDS, how can I parse dynamic Soap response from a webservice to XML slurper directly without storing this response in any file.
    Thanks in advance.