2017-12-11 11 views
1
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:エンベロープ= {= {石鹸:本体= {NS2:loginResponse = {を= {返す= a866fb4f-47E 4から4895 }}}、@ = {xmlns:soap = schemas.xmlsoap.org/soap/envelope}}}、responseStatus = 200、__loop = -1、responseCookies = null、token = a866fb4f-47e4-4895-ac13-2118b6c025c8空手要求から一つの変数を取得

リクエストからこの応答があります。私はどのようにして身体から「リターン」または「トークン」を得ることができますか?

+1

この文書のこのセクションを参照して、XMLで回答を得てください:https://github.com/intuit/karate#type-conversion | SOAPデモの例も参照してください:https://github.com/intuit/karate/blob/master/karate-demo/src/test/java/demo/soap/soap.feature –

答えて

1

calling featuresのドキュメントは読んでいないようです。どのように動作するのか分からない限り、callはまったく使用しないことをお勧めします。

私は(まだ)あなたの応答XMLを読むことができないので、//returnが実際にあなたに必要な値を与えるかどうかは言えません。それを仮定すると、RequestToken.featureの右のresultという変数に割り当てられました。これでは、これを試してみてください:

# this result will again contain a variable 'result' 
* def result = call creator 
* def return = result.result 
* print return 

あなたが慎重に文書を慎重に読んでいない限り、私はもっと助けることはできません。

+1

素早く答えてくれたPeterに感謝します!すべてが今働いています。 – Skyx

+0

@Skyx \ * phew \ *!それを聞いてうれしい:) –

関連する問題