Extrayendo detalles de la respuesta a la nueva solicitud SoapUI

I'm using SoapUI 3.6.1. I need to pull details from response and insert them to next request. I try to do this by'Property Transfering'. In first request I'm getting some details and in the response I can see 'Sections'. This 'section' can contain many 'Controls' and every 'Control' has some values. My response i'm getting:


The main conditions are to get only 'Controls' which are mandatory (true) and only one of available 'Values'. Details I need to get in next request is like these:


It means i need 'Code' , 'Id', 'Value' , 'Value code' from response. Maybe there is the possibility to use 'If..Else' statement or smth else. Thanks in advance.

preguntado el 09 de marzo de 12 a las 16:03

1 Respuestas

  1. Create a new property in your test case, called ValuesXML
  2. Add a step with your original request, the source data
  3. Create a property transfer step
  4. Add a new transfer
  5. Select source as the xml from your response
  6. Check the "use XQuery" checkbox
  7. Select target as the property ValuesXML
  8. Add the code below to the source window
  9. Add a step with the target request, where you want your modified data
  10. In the XML request, where the clause should be, put ${#TestCase#ValuesXML}
  11. ¡IR!

The code, that should go in the "source" of the property transfer

    for $z in //Control
    where $z/Mandatory eq "true"    
                let $values :=
                for $x in //Value          
                order by $x/SortOrder
                return $x/Value 

            return $values[1]

NOTE: You might have to add an "a:" in front of the tag names in the XQuery expression, to read your source data correctly. That will also require you to declare the "a" namespace, which is easily done with the "declare" button.

respondido 21 mar '12, 15:03

I assumed you wanted the lowest sort order value first. It required quite a bit of XQuery, which is not my area of expertise... Also, I am using the Pro version 4.5, so let me know if you have problems with it in SoapUI. - Por Åkerberg

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.