Reputation: 117
I'm receiving a 15 digit user ID and wanna trim its last 3 digit then send back to request sender. Request sample is below :
<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>
I have read this http://www.soapui.org/Service-Mocking/creating-dynamic-mockservices.html but could not figure out..
Upvotes: 2
Views: 5612
Reputation: 117
I could not do it by XPATH on the other hand XmlSlurper has worked..
import groovy.util.XmlSlurper
def parsedContent = new XmlSlurper().parseText(mockRequest.requestContent)
context.MSISDN = parsedContent.Body.lookupSubscriberInfo.subscriberRequestList.opaqueId.toString().substring(3,15)
In order to use MSISDN value ou should use the following
${MSISDN}
Upvotes: 3