Forum Discussion

sonata's avatar
sonata
New Contributor
13 years ago

Groovy.lang Missing property extension

Hi All,

I am a newbie. stuck with a silly issue.

In the attachment below is the xml response of a request. while i try to run the below script to check the condition expirationTime>33, i get the error groovy.lang.missingpropertyexception no such property: expirationTime for class. any help on how to get over this error?


def alert = com.eviware.soapui.support.UISupport;

def inputFile = new File("C:\\response.xml")
if(!inputFile.exists())
{
//Display an alert if the file is not found.
alert.showInfoMessage("Input File 'Response.xml' not found!");
}
else
{
def InputXML = new XmlParser().parseText(inputFile.text);
def InputRow = InputXML.return..findAll{ it.expirationTime.text().toInteger() > 33};
InputRow.each{
log.info(it.userId.text());

}
}

1 Reply

  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    This might be easier:


    ...
    else {
    def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
    def holder = groovyUtils.getXmlHolder( inputFile.text )
    holder.getDomNodes('//return[number(expirationTime)>33]/userId/text()').each {
    log.info it.nodeValue
    }
    }