Groovy Script
Explanation
This script performs the following operations:- XML Parse: XML data coming from request body is parsed
- Body Element Finding: First element in Body is found
- Element Check: Checks if the specified element exists
- Element Addition: If element does not exist, it is added to the child element within body
- XML Serialize: Updated XML is serialized
This script should be run on the request line (Request Policy) because it uses the
requestBodyTextFromClient and requestBodyTextToTargetAPI variables. You need to write the actual element name instead of <ELEMENT_NAME>.
