tim
16 years agoContributor
How do I retreive a value from a Request when creating a Mock Service?
Here is my request xml:
How do I access callADouble? I would like to construct a response that doubles the value in the callADouble request.
I have tried
But I get the following error:
<E:Envelope xmlns:E="http://schemas.xmlsoap.org/soap/envelope/" xmlns:A="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.w3.org/2001/XMLSchema" E:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<E:Body>
<m:callADouble xmlns:m="http://www.abc.com/xyz/simpleservice" s:type="y:double">2.54</m:callADouble>
</E:Body>
</E:Envelope>
How do I access callADouble? I would like to construct a response that doubles the value in the callADouble request.
I have tried
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
def holder = groovyUtils.getXmlHolder(mockRequest.requestContent)
def a = holder.getNodeValue("//m:callADouble") as double
But I get the following error:
<soapenv:Fault>
<faultcode>Server</faultcode>
<faultstring>java.lang.Exception: net.sf.saxon.trans.XPathException: XPath syntax error at char 15 in {//m:callADouble}: Prefix m has not been declared</faultstring>
</soapenv:Fault>