空手道:处理来自被调用特征文件的 soap 响应
karate : handling soap response from a called feature file
first.feature
给定你的''
- def payload = read('')
- 请求负载
- 肥皂剧''
- 价值=/Envelope/Body/Response/Result/Num
- print value # 按预期正确打印值
second.feature
背景:
*def fetch = 读取('first.feature')
*def data = 调用 fetch
场景:
- print data.response # 以 json 格式打印 soap 响应。
- def res = data.response
- print res["s:Envelope"][""]["s:Body"]["Response"][""]["Result"][ "_"]["a:num']
first.feature 按预期工作(响应在 soap 中)
当我尝试在另一个功能中调用此功能时,响应为 json 格式。
我想使用此响应中的值将其传递给另一个请求。
我必须使用 res["s:Envelope"]["_"]["s:Body"][][].. 才能做到这一点。
有没有办法像我们在 first.feature 中那样轻松地从此响应中获取值?
请任何人告诉我如何实现这一目标。
进行此更改:
* xml res = data.response
我们会在下个版本中改进这个,如果你能测试develop
分支并确认就更好了:https://github.com/intuit/karate/wiki/Developer-Guide
first.feature 给定你的''
- def payload = read('')
- 请求负载
- 肥皂剧''
- 价值=/Envelope/Body/Response/Result/Num
- print value # 按预期正确打印值
second.feature 背景: *def fetch = 读取('first.feature') *def data = 调用 fetch
场景:
- print data.response # 以 json 格式打印 soap 响应。
- def res = data.response
- print res["s:Envelope"][""]["s:Body"]["Response"][""]["Result"][ "_"]["a:num']
first.feature 按预期工作(响应在 soap 中) 当我尝试在另一个功能中调用此功能时,响应为 json 格式。
我想使用此响应中的值将其传递给另一个请求。 我必须使用 res["s:Envelope"]["_"]["s:Body"][][].. 才能做到这一点。
有没有办法像我们在 first.feature 中那样轻松地从此响应中获取值? 请任何人告诉我如何实现这一目标。
进行此更改:
* xml res = data.response
我们会在下个版本中改进这个,如果你能测试develop
分支并确认就更好了:https://github.com/intuit/karate/wiki/Developer-Guide