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
For Python support you need to download the 'jython.jar' from the Maven repository for Jython, and copy it into the 'lib' folder of Synapse . The Jython JAR can be downloaded from here
JSON is a lightweight data-interchange format. It can be used as an alternative to XML or SOAP. From Synapse 3.0.0 onward, there are no additional steps required to enable JSON.
To enable JSON support on Synpase versions prior to 3.0.0, the 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 158, you should also add the above two entries to the 'samples/axis2Client/client_repo/conf/axis2.xml' file.