我收到了一个15位数的用户ID,并希望修剪其最后3位数字,然后发回给请求发件人。申请样本如下:
<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 但是想不出来..
答案 0 :(得分:2)
import groovy.util.XmlSlurper
def parsedContent = new XmlSlurper().parseText(mockRequest.requestContent)
context.MSISDN = parsedContent.Body.lookupSubscriberInfo.subscriberRequestList.opaqueId.toString().substring(3,15)
为了使用MSISDN值,您应该使用以下
$ {MSISDN}