Forum Discussion

Kevin_Mannering's avatar
Kevin_Mannering
Occasional Contributor
16 years ago

Documentation of the getXmlHolder Method with examples

Hi,

I am a soupui pro user getting started.

I have managed to get my response into a holder and save it for each iteration in a unique file.

def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder( "Erstbereitstellung ISP0 --> Aufruf 1#Response" )
millis = System.currentTimeMillis ()
long seconds = millis/1000
myfilename = "D:capturedrequest"  +  "$seconds" + ".xml"
file2 = (myfilename) 
log.info "$myfilename"
def response = holder.getXml()
file2 << response

Now I would like to get an element from the Response rather than the whole response.

For example, my response contains:


           
               89737666

How can I retun that ID?

Is the docu here really all you have:

http://www.soapui.org/userguide/functio ... roovyUtils?

We have Pro licenses. Is this the right place to post questions?

Rgds, Kevin

4 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hello,



    def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
    def holder = groovyUtils.getXmlHolder("Erstbereitstellung ISP0 --> Aufruf 1#Response")

    log.info( holder.getNodeValue("//Payload//Angebot//ID"))



    Let me know does this work for you.
    For pro support post questions in pro forum next time, please.

    robert
  • Kevin_Mannering's avatar
    Kevin_Mannering
    Occasional Contributor
    Hi,

    I have asked our license manager for the login details for Pro, but she is out of house till 17. March.

    Got a NULL response in the logfile with that code you gave me.

    Guess it may have something to do with the namespace.

    Another scripter who is experienced with Pro is back Monday, so lets have a nice weekend and take it further after that.

    Rgds,

    Kevin
  • DGramß's avatar
    DGramß
    Occasional Contributor
    Hi,

    we fixed this with

    log.info( holder.getNodeValue("//ns1:Angebot//ns1:ID"))

    That returned the id.

    Now posting on Soapui Pro Forum.

    BTW I am a good boy who likes to rtfm.

    is there any docu on .getNodeValue etc..?

    Rgds, Kevin
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hello!

    Unfortunately, there isn't much documentation available on the XmlHolder class.
    You can view the Javadoc here, which at least shows you the available methods and what to pass to them.

    Regards,
    Dain
    eviware.com