在 SoapUI 模拟服务响应脚本中,我需要使用请求中的值。我试图让 value_2 在响应中使用它。
例如 SOAPUI 模拟服务收到以下请求:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="urn:company:test">
<SOAP-ENV:Body>
<ns1:field_1 xmlns="urn:company:test">
<field_2>
<field_3>value_1</field_3>
</field_2>
<field_4>
<field_5>
<field_6>value_2</field_6>
</field_5>
</field_4>
<field_4>
<field_5>
<field_6>value_3</field_6>
</field_5>
</field_4>
</ns1:field_1>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
我访问了以下链接,但它对我不起作用。
我也尝试了以下几行但失败了。
def req = new XmlSlurper().parseText(mockRequest.requestContent)
context.theValue = req.field_1.field_4.field_5.field_6
另请注意,我使用的是基本版(不是专业版)
你能帮我解决这个问题吗?
谢谢,托尼