[英]groovy.lang.MissingMethodException: No signature of method in groovy script
Can some one please help me with the following code. 可以请下面的代码帮助我。 It is causing "groovy.lang.MissingMethodException: No signature of method: java.lang.String.setNodeValue() is applicable for argument types: (java.lang.String, java.lang.String) values: [//ns:tem:intA, 50] error at line: 14" error.
它导致“ groovy.lang.MissingMethodException:方法的无签名:java.lang.String.setNodeValue()适用于参数类型:(java.lang.String,java.lang.String)值:[// ns: tem:intA,50]行错误:14“错误。
def getaddresponse=context.expand('${Add SOAP Request#response}')
import com.eviware.soapui.support.XmlHolder
def addresponseholder= new XmlHolder(getaddresponse)
addresponseholder.namespaces["ns"]="http://tempuri.org/"
def addresponsenodevalue=
addresponseholder.getNodeValue("//ns:AddResult")
def deleterequest=context.expand('${Delete SOAP Request#request}')
def deleteholder =new XmlHolder (deleterequest)
deleteholder.namespaces["ns"]="http://tempuri.org/"
deleterequest.setNodeValue("//ns:tem:intA",addresponsenodevalue)
def updatedxml=deleterequest.getXml()
The problem is that context.expand(String content) returns a String
, which by default does not have the method setNodeValue(String xpath, Object value) . 问题是context.expand(String content)返回一个
String
,默认情况下没有方法setNodeValue(String xpath,Object value) 。
Try calling setNodeValue()
on your deleteholder
instead: 尝试
setNodeValue()
在您的deleteholder
上调用setNodeValue()
:
deleteholder.setNodeValue("//ns:tem:intA",addresponsenodevalue)
def updatedxml=deleteholder.getXml()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.