Groovy Template for Manipulating Output from a REST Connector Response

In the Orchestrator Studio, the Connector design page provides a Groovy code template that you can use to manipulate the output from a REST connector response.

The response can contain output in XML, which you can convert to JSON using Groovy. For example, your orchestration might include a step with a REST connector to a third-party system, and its response may return in XML. You could write a Groovy script to reformat that response in JSON.

Groovy Code Template for Manipulating REST Connector Output

The following list describes the highlighted sections in the preceding code:

  1. You can add or remove import lines as necessary.

  2. Do not modify the function definition or script definition.

    The main function uses "string in" and "string out," which cannot change.

    Call other functions in the script and define them below.

  3. Copy and paste the code in the commented lines and use them in your script.

    The code lines include parameters for defining a string, numeric value, date format, and date value, as well as writing log entries and populating the returnMap for outputs. The code lines also include parameters for including a warning or log statements in the AIS Server log, which can be used for debugging script issues.

The Groovy template also includes an orchAttr that enables you to include additional information in the Groovy script. See Additional Attributes and Methods Available in the Groovy Script Templates.