【发布时间】:2014-09-18 09:22:22
【问题描述】:
我在 SOAPUI 中使用 Groovy Script 来实现几个模拟服务。我正在尝试通过 groovy 脚本修改 XML 文件,但它不起作用。请帮帮我
我想更改此文件中<STATUS> 的值
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns5:PCH1CRTO_REC xmlns:ns2="http://www.csc.smart/bo/schemas/Error" xmlns:ns3="http://www.csc.smart/bo/schemas/PCH1CRTI" xmlns:ns4="http://www.csc.smart/msp/schemas/MSPContext" xmlns:ns5="http://www.csc.smart/bo/schemas/PCH1CRTO" xmlns:ns6="http://www.csc.smart/bo/schemas/PCH1ENQI" xmlns:ns7="http://www.csc.smart/bo/schemas/PCH1ENQO">
<STATUS>0</STATUS>
我在 SOAPUI 中的 groovy 脚本
filePath = groovyUtils.projectPath + "\\Response-Client-Details\\Response-Policy-List\\Response-Policy-Details\\" + fileArray[i] + ".xml"
def root = xmlParser.parse(filePath)
接下来我要做什么?我尝试了很多方法,但它不起作用,甚至得到<STATUS> 的值。谢谢
【问题讨论】:
-
它最终奏效了吗?
-
还没有,我不能写xml文件
-
我修好了,因为昨天加班太晚了。我有解决方案!你是最好的合作伙伴,非常感谢@mitomed