Forum Discussion

fredand44's avatar
fredand44
New Contributor
17 years ago

How to extract an element with XPath for property transfer?

Hello Guys!

I'm struggling with a TestCase in SoapUI 3.0.1 (Free).
The idea is to shoot a request, and from the response extract a value and put in to an other request.

The response I got from the first request looks like:


 
      <_:save xmlns:_="http://www.xyz.se/wsdl" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.xyz.se/types">
        <_:a>
           
           
              a@b.com
              54132737
           

       

     

 


Now I would like to extract the "tekniskNyckel" and put into my next request va Property Transfer.

SoapUI helps me declare the namespaces:

declare namespace soap='http://schemas.xmlsoap.org/soap/envelope/';
declare namespace ns1='http://www.xyz.se/types';
declare namespace ns2='http://www.xyz.se/wsdl';


But I can not find out how to write the xpath to the value, for eg I have tried:
ns2:a/ns1:b/ns1:c/ns1:tekniskNyckel

So the total text in the source textarea looks like:

declare namespace soap='http://schemas.xmlsoap.org/soap/envelope/';
declare namespace ns1='http://www.xyz.se/types';
declare namespace ns2='http://www.xyz.se/wsdl';
ns2:a/ns1:b/ns1:c/ns1:tekniskNyckel


But it does not manage to extract anything when I run it in SoapUI.

So if any one got any idea what I'm doing wrong please let me know.

Best regards
Fredrik

1 Reply

  • fredand44's avatar
    fredand44
    New Contributor
    Hello all!

    I think I just solved it, perhaps not the best solution but it works for me!

    // = Searches for any node, regardless of where the nodes position is in the document.

    Then my search string gets to be:
    //tekniskNyckel

    Best regards
    Fredrik