我收到一个 15 位数字的用户 ID,并希望删除其最后 3 位数字,然后发送回请求发件人。索取 sample 如下:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
<lookupSubscriberInfo xmlns="http://testID.com/V1_0">
<callingParty>testParty</callingParty>
<subscriberRequestList>
<testId>888905425616681</opaqueId>
</subscriberRequestList>
</lookupSubscriberInfo>
</env:Body>
</env:Envelope>
我读过这篇文章 http://www.soapui.org/Service-Mocking/creating-dynamic-mockservices.html 但无法弄清楚..
最佳答案
我无法通过 XPATH 做到这一点,但 XmlSlurper 却可以工作..
import groovy.util.XmlSlurper
def parsedContent = new XmlSlurper().parseText(mockRequest.requestContent)
context.MSISDN = parsedContent.Body.lookupSubscriberInfo.subscriberRequestList.opaqueId.toString().substring(3,15)
为了使用 MSISDN 值,您应该使用以下内容
${MSISDN}
关于soap - 将值从请求传输到响应(soapUI 模拟服务),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13738362/