我不知道这是否是你想要什么来实现的,但是如果你有一个叫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