将值从请求传输到响应(soapUI模拟服务) [英] transferring values from request to response (soapUI mock service)

查看:82
本文介绍了将值从请求传输到响应(soapUI模拟服务)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在接收一个15位数字的用户ID,并希望修整其最后3位数字,然后发回给请求发件人.请求样品如下:

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>

我已经读过了 http://www.soapui.org/Service-Mocking/creating-dynamic -mockservices.html 但不知道..

I have read this http://www.soapui.org/Service-Mocking/creating-dynamic-mockservices.html but could not figure out..

推荐答案

另一方面,我无法通过XPATH做到这一点XmlSlurper起作用了..

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)

为了使用MSISDN值,ou应该使用以下

In order to use MSISDN value ou should use the following

$ {MSISDN}

${MSISDN}

这篇关于将值从请求传输到响应(soapUI模拟服务)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆