How to add complex data type from Groovy script to the response in SoapUI

Posted by SeeU on Stack Overflow See other posts from Stack Overflow or by SeeU
Published on 2010-06-10T11:59:38Z Indexed on 2010/06/10 12:02 UTC
Read the original article Hit count: 280

Filed under:
|
|
|
|

My question is about putting data elements (from groovy script) in the response in SoapUI. I've an array of data that I would like to put in my response (in different tags/elements)


I'm aware of putting a simple element like this:

The element "MyName" in the Xml response:

<ns:MyName>${MyName}</ns:MyName>

Is mapped from the Groovy script by

context.setProperty("MyName" , "My name" )


Now the problem:

my Xml response looks like this:

   <soapenv:Body>
  <ns:GetDataSummaryResponse>
     <!--Optional:-->
     <ns:GetDataSummaryResult>
        <ns:DataSummary>
           <!--Zero or more repetitions:-->
           <ns:DataSummaryResponseDetail>
              <ns:Name>?</ns:Name>
              <!--Optional:-->
              <ns:DataProgress>
                 <!--Optional:-->
                 <From>?</From>
                 <!--Optional:-->
                 <Procent>?</Procent>
                 <!--Optional:-->
                 <To>?</To>
                 <!--Optional:-->

In Groovy I've built data array which is filled with data for example like this:

context:[DataSummary:[DataSummaryResponseDetail:[Name:My name, DataProgress:[From:some text, Procent:some value, To:some text]]]

In the response I'm able to see the whole value of ${DataSummary} but how do I get the element "Procent"

I maybe am wrong about how to build my context data, but feel free to adjust!

BR/SeeU

© Stack Overflow or respective owner

Related posts about groovy

Related posts about response