karate : handling soap response from a called feature file

爷,独闯天下 提交于 2021-02-10 23:42:42

问题


first.feature Given ur ''

  • def payload = read('')
  • request payload
  • soap action ''
  • value = /Envelope/Body/Response/Result/Num
  • print value # prints value correctly as expected

second.feature Background: *def fetch = read('first.feature') *def data = call fetch

Scenario:

  • print data.response # prints the soap response in json format.
  • def res = data.response
  • print res["s:Envelope"][""]["s:Body"]["Response"][""]["Result"]["_"]["a:num']

first.feature works as expected ( response is in soap ) When I try to call this feature in another feature then the response is in json format.

I want to use a value from this response to pass it on to another request. I had to use res["s:Envelope"]["_"]["s:Body"][][].. to get to that.

Is there a way to easily fetch a value from this response as we do in first.feature? Please could anyone let me know how to achieve this.


回答1:


Make this change:

* xml res = data.response

We will be improving this in the next version, it would be good if you can test the develop branch and confirm: https://github.com/intuit/karate/wiki/Developer-Guide



来源:https://stackoverflow.com/questions/62856243/karate-handling-soap-response-from-a-called-feature-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!