Skip to main content

Groovy Script

Explanation

This script performs the following operations:
  1. XML Parse Operation: Counts <item> elements in the response
  2. Data Extraction: Extracts data for each item using XPath
  3. JSON Creation: Places extracted data into JSON template
  4. API Call: Sends the created JSON to another API with POST request
  5. Error Management: Creates error message in case of error, returns SOAP response in case of success
This script should be run on the response line (Response Policy) because it uses the responseBodyTextFromTargetAPI and responseBodyTextToClient variables.