空手道从请求中获取一个变量

时间:2017-12-11 16:03:48

标签: json api karate

    Given request
"""
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.openkm.com">
   <soapenv:Header/>
   <soapenv:Body>
      <ws:login>
         <!--Optional:-->
         <user>TestUser</user>
         <!--Optional:-->
         <password>TestUser</password>
      </ws:login>
   </soapenv:Body>
</soapenv:Envelope>
"""
When soap action 'http://ws.openkm.com/OKMAuth/login'
Then status 200
  * def token = //return

结果=响应= {soap:Envelope = { = {soap:Body = {ns2:loginResponse = { = {return = a866fb4f-47e 4-4895-ac13-2118b6c0 25c8},@ = {xmlns:ns2 = ws.openkm.com}}}},@ = {xmlns:soap = schemas.xmlsoap.org / soap / envelope}}},responseStatus = 200,__ locop = -1,responseCookies = null,token = a866fb4f-47e4-4895-ac13-2118b6c025c8}

我收到了请求的回复。如何才能获得“返回”#39;或者#令牌&#39;从身体?

1 个答案:

答案 0 :(得分:1)

您似乎没有阅读calling features上的文档。除非您清楚它是如何工作的,否则我建议您根本不要使用/* * CSS Styles are from .visuallyhidden rule of * HTML5Boilerplate for proper accessibility. * * @Link: https://github.com/h5bp/html5-boilerplate/blob/6.0.1/dist/doc/css.md#visuallyhidden */ .woocommerce-shipping-fields__field-wrapper label, .woocommerce-billing-fields__field-wrapper label { border: 0; clip: rect(0 0 0 0); -webkit-clip-path: inset(50%); clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; white-space: nowrap; /* 1 */ }

我(仍)无法阅读您的回复XML,因此我无法说call是否真正获得了您想要的价值。假设确实如此,您现在已将其分配给//return右侧的result变量。现在,试试这个:

RequestToken.feature

除非你仔细阅读文档,否则我无法提供更多帮助。