【发布时间】:2017-12-11 16:03:47
【问题描述】:
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
结果 = response={soap:Envelope={={soap:Body={ns2:loginResponse={= {return=a866fb4f-47e4-4895-ac13-2118b6c0 25c8},@={xmlns:ns2=ws.openkm.com}}}},@={xmlns:soap=schemas.xmlsoap.org/soap/envelope}}},responseStatus=200,__loop=-1,responseCookies =null,令牌=a866fb4f-47e4-4895-ac13-2118b6c025c8}
我从一个请求中得到了这个响应。如何从 body 中获取“return”或“token”?
【问题讨论】:
-
您能否参考文档的这一部分并以 XML 格式获取响应:github.com/intuit/karate#type-conversion |另请参阅 SOAP 演示示例:github.com/intuit/karate/blob/master/karate-demo/src/test/java/…