Reputation: 38180
I want to set the value of token in this soap ws header
<soapenv:Enveloppe ...
<soapenv:Header>
<web:token>123456 </web:token>
FROM step named test get idSession in 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>
I tried to put in-between web:token tag
${test#Response#//ns1:authentification/bloc1/bloc2/idSession}
but it does not work
What should I put instead ?
Upvotes: 1
Views: 3237
Reputation: 18507
I'm not sure if this is what you're trying to achieve, however If you have a SOAP Test step
called Test Request
and you want to use the value of the <soapenv:Header><web:token></soapenv:Header>
of this request in another SOAP Test step
you can refer this value in the second SOAP Test step
request using the follow syntax:
<soapenv:Enveloppe ...
<soapenv:Header>
<web:token>${Test Request#Request#//soapenv:Header/web:token}</web:token>
The syntax ${Test Request#Request#//soapenv:Header/web:token}
has three parts, the name of the test step, followed by the property (could be #Request
or #Response
), and finally the xpath
to get the value //soapenv:Header/web:token
.
UPDATED:
As you said you've two SOAP Test Request
, the first one is called test
an has the follow 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>
The second is named for example test 2
(don't care because the second name not affect your purpose) and has the follow 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>
With ${test#Response#//ns1:authentification/bloc1/bloc2/idSession}
you're referencing the idSession
value of the test
response correctly. Take a look on the http log
tab when you send your test 2
as shown in the follow image:
Hope this helps,
Upvotes: 3