Forum Discussion

senthkum's avatar
senthkum
Contributor
5 years ago

Capture request node value with groovy script

Hi All,

I would like to capture the values of Search Node, but the existing code returns me null values. What could be the issue here. I have written this code in ServiceV Pro.

Code:

def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
def holder = groovyUtils.getXmlHolder(mockRequest.requestContent)
def queryString = holder.getNodeValue("//ond:search")
log.info "QueryString: " + queryString

Request XML

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ond="http://www.qas.com/OnDemand-2011-03">
<soapenv:Body>
<ond:QASearch Localisation="" RequestTag="Intuitive">
<ond:Country>AUE</ond:Country>
<ond:Layout></ond:Layout>
<ond:search>1 Lonsdale Close, LAKE HAVEN NSW 2263</ond:search>
<ond:FormattedAddressInPicklist>false</ond:FormattedAddressInPicklist>
</ond:QASearch>
</soapenv:Body>
</soapenv:Envelope>

Thanks

Senthil kumar.M

1 Reply

  • nmrao's avatar
    nmrao
    Champion Level 3
    This is very late reply due to incorrect forum. Do you still have issue? Are you using the above in Script Dispatch?