soap - 将值从请求传输到响应(soapUI 模拟服务)

标签 soap mocking request response soapui

我收到一个 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/

相关文章:

java - 如何在 JAVA SOAP 中使用相同的参数名称接收和发送

unit-testing - 方法设置中的 Moq 匹配和验证数组/IEnumerable 参数

模拟对象中的 CakePHP "with"方法不起作用

vue.js - 开 Jest 测试正在从 Vue 观察器调用函数

javascript - Cypress : How can we write GET request in with bearer token in cypress?

java - Spring 我可以用 multipart/form-data 发布 params 数组吗

java - MarshallingWebServiceInboundGateway 的问题

java - 如何将 zip 文件转换为八位字节流

wcf - 如何在WCF请求和响应的soap header 中添加MessageID?

python - 如何从 Python 中的 HTTP cookie 中提取特定 key ?