Forum Discussion

mcgintym's avatar
mcgintym
Occasional Contributor
15 years ago

getNodeValue is not passing the value from XPath to variable

Has anyone seen this issue.  When asserting a value from a database property vs. a holder.getNodeValue.  The getNodeValue is not passing the value as expected? 

Here is my groovy script assertion

//Compare values in XML response with property values taken from the database
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );
def holder = groovyUtils.getXmlHolder( messageExchange.responseContent );
//Get nodeValue - "Id"
def responseId = holder.getNodeValue["//ns2:getServicePResponse/ns2:getServicePReturn/serviceP/id"];
//get value from test step for comparison db retrieval
def propId = context.getProperty( "getIdfromDB", "DbId" );
//assert Comparison on captured values
assert (responseId == propId);
log.info responseId+" "+propId

The message I get is

Expression: (responseId == propId). Values: responseId = [], propId = 123456789

You can see the responseID is []  Can someone help me figure out what I am missing?


The XML Response is below...


 
     
       
           
              123456789
              2001-08-01-04:00
              2005-07-31-04:00
              Happy
              Action Explicit
              Retail
              No Longer Employed
             
                  2001-08-01-04:00
                  2001-10-31-05:00
             

           
>
       

     

 



Any help would be appreciated

Thanks

13 Replies