Apache Synapse ships with a set of scripting samples. This document explains how to setup the necessary script engines for these samples. In addition this guide describes how to setup the JSON message builder and formatter for JSON mediation samples.
The Synapse Script Mediator is a Synapse extension, and thus all prerequisites are not bundled by default with the Synapse distribution.Before you use some script mediators you may need to manually add the required jar files to the Synapse lib directory, and optionally perform other installation tasks as may be required by the individual scripting language. This is explained in the following sections.
The JavaScript/E4X support is enabled by default and comes ready-to-use with the Synapse distribution.
For Ruby support you need to download the 'jruby-complete.jar' from the Maven repository for JRuby, and copy it into the 'lib' folder of Synapse . The JRuby JAR can be downloaded from here
JSON is a lightweight data-interchange format. It can be used as an alternative to XML or SOAP. To enable the JSON support in Synapse, following two jar files should be deployed into the 'lib' directory of Synapse.
Jettison 1.1 is recommended.
Having deployed the necessary libraries you should now register the JSON message builder and formatter with Synapse. Open up 'repository/conf/axis2.xml' file of Synapse and add the following two entries under the 'messageBuilders' and 'messageFormatters' sections respectively.
If you are planning to run sample 440, you should also add the above two entries to the 'samples/axis2Client/client_repo/conf/axis2.xml' file.