Xml 在soapui中为REST服务编写groovy脚本
我试图从groovy脚本中的REST服务获取响应,如下所示:Xml 在soapui中为REST服务编写groovy脚本,xml,rest,groovy,soapui,Xml,Rest,Groovy,Soapui,我试图从groovy脚本中的REST服务获取响应,如下所示: def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ) def holder = groovyUtils.getXmlHolder("REST-options-Default#Response") 其中,“REST options Default”是测试步骤名称 但是得到以下错误: org.apache.xmlbeans.XmlException
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder("REST-options-Default#Response")
其中,“REST options Default”
是测试步骤名称
但是得到以下错误:
org.apache.xmlbeans.XmlException:error: Unexpected element:CDATA
在SOAP的情况下也是如此
请告知。您必须使用responseAsXml而不是response。更改代码以避免XmlException:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder("REST-options-Default#responseAsXml")
根据请求类型,您必须使用response或responseAsXml属性,例如在soap测试请求中,response与response一起工作,但与responseAsXml一起工作,而与jdbc测试请求一起工作,但与responseAsXml一起工作,而与response一起工作
希望这有帮助,响应xml是什么样子的?