Adrian
Adrian

Reputation: 143

SOAPUI Extract data from SOAP Response and use in REST request

I have been looking at the answer to this question:

Pulling details from response to new request SoapUI

which is similar to what I am looking for but I can't get it to work.

I have a small SOAPUI testsuite and I need to extract a value from the response of a SOAP request and then use this value in a subsequent REST request.

The response to my SOAP request is:

<ns0:session xmlns:ns0="http://www.someurl.com/la/la/v1_0">
   <token>AQIC5wM2xAAIwMg==#</token>
</ns0:session>

so I need the token to use in my REST request. I know it involves using Property Transfer and some XPath / XQuery but I just can't get it right. At the moment my property transfer window points to Source: SOAP test Property: Response and has data(/session/token/text()) in the text box. In target it has Target: REST testcase Property: newProp and I have Use XQuery checked.

Any help greatly appreciated.

Thanks, Adrian

Upvotes: 0

Views: 7545

Answers (1)

Per &#197;kerberg
Per &#197;kerberg

Reputation: 354

I think you just need to declare the namespace ns0 and use it in the XPath. Also, uncheck the XQuery, it is only used when you are using XQuery, not XPath.

Replace your expression with this:

declare namespace ns0='http://www.someurl.com/la/la/v1_0';
/ns0:session/token/text()

Upvotes: 2

Related Questions