transferring values from request to response (soapUI mock service)

坚强是说给别人听的谎言 提交于 2019-12-11 02:35:42

问题


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..


回答1:


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}



来源:https://stackoverflow.com/questions/13738362/transferring-values-from-request-to-response-soapui-mock-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!