Forum Discussion
richard_mccarth
16 years agoContributor
Hi Ole,
Thanks for your reply. I dug around and managed to figure out the basic formats for XPath and script as shown below.
XPath
--------
Return the data of the FromCurrency element in the 'web' namespace in the request, this needs to match a response name configured for the request.
e.g. if the from currency is USD then you need a response called USD
declare namespace web='http://www.webserviceX.NET/';
//web:FromCurrency/text()
Note where the return does not match a response name then you get the default response.
Script
-------
Using the same idea as above but with a script instead
def groovyUtils = new com.eviware.soapui.support.GroovyUtils (context)
def holder = groovyUtils.getXmlHolder ( mockRequest.requestContent )
def fromCcy = holder.getNodeValue("//web:FromCurrency/text()")
return fromCcy
Note it appears that where the return does not match a response name then you do not get the default response.
Thanks for your reply. I dug around and managed to figure out the basic formats for XPath and script as shown below.
XPath
--------
Return the data of the FromCurrency element in the 'web' namespace in the request, this needs to match a response name configured for the request.
e.g. if the from currency is USD then you need a response called USD
declare namespace web='http://www.webserviceX.NET/';
//web:FromCurrency/text()
Note where the return does not match a response name then you get the default response.
Script
-------
Using the same idea as above but with a script instead
def groovyUtils = new com.eviware.soapui.support.GroovyUtils (context)
def holder = groovyUtils.getXmlHolder ( mockRequest.requestContent )
def fromCcy = holder.getNodeValue("//web:FromCurrency/text()")
return fromCcy
Note it appears that where the return does not match a response name then you do not get the default response.
Related Content
Recent Discussions
- 6 days agoruchisingh