【问题标题】:transferring values from request to response (soapUI mock service)将值从请求传输到响应(soapUI 模拟服务)
【发布时间】:2012-12-06 06:48:35
【问题描述】:

我收到了一个 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 但想不通..

【问题讨论】:

    标签: soap mocking request response soapui


    【解决方案1】:

    另一方面,我无法通过 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}

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多