soapui - XMLHolder in groovy unable to Retrieve value -


i have following xml:

<soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema">    <soap-env:body>       <login_v1response>          <result xsi:nil="true"/>          <opsessionid>fjqkjejipbhkdiin</opsessionid>       </login_v1response>    </soap-env:body> </soap-env:envelope> 

i have following code in groovy returns me null:

def groovyutils=new com.eviware.soapui.support.groovyutils(context) def holder = groovyutils.getxmlholder("step1-login#response") log.info holder.getnodevalue("//soap-env:envelope/soap-env:body/login_v1response/opsessionid") 

please out. thanks.

you using namespaces in script, without defining namespaces are. reading values easier use wildcards , not worry them.

def groovyutils=new com.eviware.soapui.support.groovyutils(context) def holder = groovyutils.getxmlholder("step1-login#response") log.info holder.getnodevalue("//*:opsessionid") 

or simpler like:

log.info context.expand('${step1-login#response#//*:opsessionid}') 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -