1
我试图从SOAP请求中获取来自json请求的值TxnType
。我想根据TxnType
的价值做出不同的回应。在SOAPUI中从json请求获取值
{
"Request": {
"UserId": "user",
"TxnType": "fetch"
}
}
我试图从SOAP请求中获取来自json请求的值TxnType
。我想根据TxnType
的价值做出不同的回应。在SOAPUI中从json请求获取值
{
"Request": {
"UserId": "user",
"TxnType": "fetch"
}
}
这里是常规脚本固定JSON
def json = """{
"Request": {
"UserId": "user",
"TxnType": "fetch"
}
}"""
def transactionType = new groovy.json.JsonSlurper().parseText(json).Request.TxnType
log.info "TxnType is : ${transactionType}"
来获取请求值,您可以快速地尝试Demo
如果要使用动态JSON中模拟脚本,那么你可以使用下面的模拟脚本调度器
def transactionType = new groovy.json.JsonSlurper().parseText(mockRequest.requestContent).Request.TxnType
log.info "TxnType is : ${transactionType}"