Nilotpol Nilotpol - 1 month ago 11x
Groovy Question

Groovy - Parse SOAP response XML to get data

I have the below value as text. I need to parse the XML and get the value for each of them. Please suggest how to do in Groovy

<soapenv:Envelope xmlns:soapenv="" xmlns:xsd="" xmlns:xsi="">
<ns0:GetListBy_QualificationResponse xmlns:ns0="urn:WS_CTM_People_ICEVA">


Assuming your xml is in a String in the variable xml, then you can do:

def mapOfValues = new XmlSlurper().parseText(xml)
                                  .getListValues.children().collectEntries {
    [, it.text()]

Which makes mapOfValues equal to a Map containing: