Forum Discussion

thatstevecena's avatar
thatstevecena
Occasional Contributor
6 years ago
Solved

Store a value from XML/XPath output of a REST query in a SoapUI property for later use

I'm new to SOAP, REST, and SoapUI. I'm working to build a test case that simulates a user login & then extracts the user list from the server. My log in command is working, and I get the XML output I...
  • thatstevecena's avatar
    thatstevecena
    6 years ago

    After posting on StackOverflow, I finally got an answer to this. The Groovy Code I posted previously *is* one way to get the Token. However, I was more interested in getting the XML property directly in the Property Transfer step.

     

    To do this, I set the Source to the previous request (GetSecurityToken) and set the Property to Response, Path language XPath. Now; inside the txt field for Source I needed to palce the following:

    declare namespace ns1='http://schemas.datacontract.org/2004/07/'; 
     //ns1:MGRestTokenResponse[1]/ns1:Token[1]

    For the Target, I specify my test step properties and then the sectoken property. This causes the XML value to be transfered in a single step versus storing the entire output & using Groovy code to extract it.