Forum Discussion

Heaven's avatar
Heaven
Occasional Contributor
15 years ago

getting trouble with rootNode

Hi
I am new to the Soap UI. and Groovy is also new to me.
Now i am getting confusion with a syntax.

request is this.

     
        ${#TestSuite#a}
        ${#TestSuite#b}
     

 


and this is the response.

soap:Body>
     
        40
     

 



now in groovy script i have doubt in this line.

def attributesNodes = rootNode["soapenv:Body"]["typ:$stepName"]["typ:Envelope"]["typ:Data"]["typ:Provider"]["typ:Sending"]["typ:Item"]["typ:Attributes"][0].children();

what to write in this maroon color lines?
please help.

6 Replies

  • Heaven's avatar
    Heaven
    Occasional Contributor
    the error message is this.

    java.lang.NullPointerException: Cannot invoke method children() on null object
  • Heaven's avatar
    Heaven
    Occasional Contributor
    sorry to say no.
    It does not helped me.
    Actually I am confused in the format of that rootNode lines.
  • Heaven's avatar
    Heaven
    Occasional Contributor
    these lines of script is getting error for me.
    I know my X path is wrong.
    But I want the format language in rootNode[.........].children();
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    I think you should have a look at the Groovy API for groovy.util.Node. rootNode["string"] is the same as rootNode.get("string"), so depending on what content you actually want you'll have to write the correct expression for it.

    Regards,
    Dain
    eviware.com