我不知道這是否是你想要什麼來實現的,但是如果你有一個叫SOAP Test step
和Test Request
要使用此請求的<soapenv:Header><web:token></soapenv:Header>
的另一SOAP Test step
值,你可以在參考這個值第二SOAP Test step
請求使用後續的語法:
<soapenv:Enveloppe ...
<soapenv:Header>
<web:token>${Test Request#Request#//soapenv:Header/web:token}</web:token>
語法${Test Request#Request#//soapenv:Header/web:token}
有三個部分,所述測試步驟的名稱,隨後由屬性(可能是#Request
或#Response
),最後是xpath
來獲取值//soapenv:Header/web:token
。
更新:
至於你說的您將兩個SOAP Test Request
,第一個被稱爲test
一個有遵循response
:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1:authentification xmlns:ns1="http://ws.demowebservices.com/">
<bloc1>
<bloc2>
<idSession>e1c64cd9-b933-4f56-ae1f-0f7d7f23942b</idSession>
</bloc2>
</bloc1>
</ns1:authentification>
</soap:Body>
</soap:Envelope>
第二個被命名爲例如test 2
(唐」因爲第二個名字不會影響你的目的),並且具有以下request
:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<web:token>${test#Response#//ns1:authentification/bloc1/bloc2/idSession}</web:token>
</soapenv:Header>
<soapenv:Body>
...
</soapenv:Body>
</soapenv:Envelope>
使用${test#Response#//ns1:authentification/bloc1/bloc2/idSession}
您正確引用test
響應的idSession
值。就拿http log
標籤一看,當你如後續圖像中發送您test 2
:
希望這有助於
您是否嘗試過的文件? http://www.soapui.org/soap-and-wsdl/headers-and-attachments.html#1-Custom-HTTP-Headers – SiKing 2015-03-02 17:35:09
SiKing建議應該幫助你。你也可以看看它和它http://www.soapui.org/scripting---properties/tips---tricks.html#5-Change-a-request-XML-from-groovy – Rao 2015-03-02 18:39:22
爲什麼我需要自定義標題還是使用groovy?爲什麼我可以使用屬性傳輸來設置請求頭像我可以使用請求主體一樣?我非常喜歡初學者,我希望儘可能簡單的解決方案:我真的有義務放棄財產轉移? – user310291 2015-03-02 22:05:49