AnsweredAssumed Answered

Constructing Dynamic Response for REST service with XML content

Question asked by SKavitha on Apr 19, 2018
Latest reply on Apr 23, 2018 by SKavitha

Hi,

 

Need to know how to construct dynamic tags in response based on tags in request for REST service with XML contents.

 

Sample request:

<client>
<Field>
<FieldName>ClientID</FieldName>
<FieldValue>123</FieldValue>
</Field>
<Field>
<FieldName>Name</FieldName>
<FieldValue>abcd</FieldValue>
</Field>
</client>

<client>
<Field>
<FieldName>ClientID</FieldName>
<FieldValue>456</FieldValue>
</Field>
<Field>
<FieldName>Name</FieldName>
<FieldValue>efgh</FieldValue>
</Field>
</client>


Sample Response:
<ClientData>
<Field>
<FieldName>EmployeeNumber</FieldName>
<FieldValue>45698</FieldValue>
</Field>
</ClientData>
<ClientData>
<Field>
<FieldName>EmployeeNumber</FieldName>
<FieldValue>7896</FieldValue>
</Field>
</ClientData>

The count of ClientData tag in response depends on count of client tag in request.

How to dynamically construct the tags in response? Pls help.

 

I believe Matchscript needs for this. If yes pls share me a sample script as I am new to it.

Outcomes