On this Page:

Related Pages:
The E2E Bridge offers the JavaScript adapter to use JavaScript with composite services. This is useful for e.g. dynamic evaluation of expressions at runtime.

Also, you can use JavaScript as a JSON pre-processor instead of the JSON parser.
JSON requests are frequently very dynamic and structurally complex. To use the JSON parser, you would have to model the JSON structure as UML class diagrams, which proved to be very error-prone. It turned out to be much easier using JavaScript to parse the message and then also JavaScript to analyze the resulting object to get all relevant data (which is frequently a small subset of the overall message).

Using the JavaScript Adapter with a Static Script

To call a JavaScript add an action having the stereotype <<JavaScriptAdapter>>. You can assign the stereotype manually or use the E2E Action Wizard.

Figure: Action with JavaScript

Add the JavaScript to the tagged value script. You can use the Action Script Editor to do that. All variables used in the script must have a corresponding object flow.

Using the JavaScript Adapter with a Dynamic Script

To call a dynamic JavaScript, add an input object of type JavaScript to the action node (e.g. script in the example below). This object should contain the custom JavaScript.

Figure: Action with Dynamic JavaScript

If input parameters are modified inside the script, the modifications will be visible outside - even if they are not defined as output.