Forum Discussion

Woogeek's avatar
Woogeek
New Contributor
12 years ago

Mock response with repetitions

I'm trying to do mock response based on the request. With a request like that:

<soapenv:Body>
<con:person>
<person>
<name>John</name>
<age>18</age>
</person>
</con:person>
</soapenv:Body>

and a reponse like that

<soapenv:Body>
<con:result>
<person>
<name>?</name>
<age>?</age>
<country>?</country>
<city>?</city>
</person>
</con:result>
</soapenv:Body>

I can use elements from the request to take what i want in database and create the response. But when i have a request with many person like that

<soapenv:Body>
<con:person>
<person>
<name>John</name>
<age>18</age>
</person>
<person>
<name>Doe</name>
<age>50</age>
</person>
</con:person>
</soapenv:Body>

I don't know how i can take all data from the request and how i can use them to create a response like that:

<soapenv:Body>
<con:result>
<person>
<name>John</name>
<age>18</age>
<country>France</country>
<city>Paris</city>
</person>
<person>
<name>Doe</name>
<age>50</age>
<country>Spain</country>
<city>Madrid</city>
</person>
</con:result>
</soapenv:Body>

With the same number of person in the request and in the response.

I hope i was clear and i thank you for your answers.
No RepliesBe the first to reply