Forum Discussion

Rebbelx's avatar
Rebbelx
Occasional Contributor
9 years ago
Solved

Groovy script get certain tag(s) from response xml

Hi,   I am rather new to groovy scripting and have a question. I have a xml request that gives a certain response: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">    <SOAP-...
  • nmrao's avatar
    nmrao
    9 years ago

    Try the below script.

     

    import com.eviware.soapui.support.XmlHolder
    def xml = new XmlHolder(context.response)
    def preValidationMinValue = xml.getNodeValue("//*:PrevalidationMin")
    new File('c:/temp/myfile.csv').write(preValidationMinValue)

    Note that, you may have to change/tune the xpath if you have multiple EAN elements to get the right value.