Bryan_Nahrwold
16 years agoContributor
Reparsing an xml string with groovy
I have the following a WSDL operation response:
<activation id="c5fb-7bfc-a755-4f07-9967" returnCode="success" description="" name="Avocent Management Platform Server" version="4.0"/><activation id="67b9-8372-eb53-4f8c-a863" returnCode="success" description="" name="Avocent Management Platform Console - 500 pack" version="4.0"/><activation id="5204-4734-c59e-4444-b734" returnCode="success" description="" name="Avocent Management Platform Reporting" version="4.0"/>
I am trying to verify that each of the three activation tags contains returnCode="success". Because I have to reparse the string content of the out tag, I have been trying to use the following groovy script:
groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
holder = groovyUtils.getXmlHolder("activateLicenses#Response")
log.info(activationOut = holder.getNodeValue( "//out" ))
This produces the response:
Thu Apr 29 16:24:14 MDT 2010:INFO:
I beleive my next step is to reparse using:
log.info(activationNode = groovyUtils.getXmlHolder(activationOut))
However, this give me an Error dialog: java.lang.NullPointerException
What call do I need to use to view this returned string as a node and what would be the code line to obtain the value of one of the attributes returnCode for an activation tag?
I am trying to verify that each of the three activation tags contains returnCode="success". Because I have to reparse the string content of the out tag, I have been trying to use the following groovy script:
groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
holder = groovyUtils.getXmlHolder("activateLicenses#Response")
log.info(activationOut = holder.getNodeValue( "//out" ))
This produces the response:
Thu Apr 29 16:24:14 MDT 2010:INFO:
I beleive my next step is to reparse using:
log.info(activationNode = groovyUtils.getXmlHolder(activationOut))
However, this give me an Error dialog: java.lang.NullPointerException
What call do I need to use to view this returned string as a node and what would be the code line to obtain the value of one of the attributes returnCode for an activation tag?