Skip to content

Instantly share code, notes, and snippets.

View bhathiya's full-sized avatar

Bhathiya Jayasekara bhathiya

View GitHub Profile
import ballerina/log;
import ballerina/http;
import ballerina/math;
import ballerina/system;
import ballerina/io;
import ballerina/mysql;
import ballerina/sql;
import ballerina/config;
const string UUID = "UUID";
<property name="xmlFile" expression="get-property('registry','gov:/test.xml')" scope="default" type="OM"></property>
<log level="custom">
<property name="Book_Name" expression="$ctx:xmlFile//book"></property>
</log>
<root>
<book>A Song of Ice and Fire</book>
<author>George R. R. Martin</author>
</root>
<script language="js" description="URL Encoding Script">
mc.setProperty("ENCODED_URL", encodeURI(mc.getProperty('URL_TO_BE_ENCODED')));
</scrpt>
<script language="js" description="Query Parameter Encoding Script">
mc.setProperty("ENCODED_PARAMS", encodeURIComponent(mc.getProperty('QUERY_PARAMS')));
</scrpt>
<property name="regProperty" expression="get-property('registry', 'gov:/data/xml/collectionx@abc')"/>
<property name="xmlfile" expression="get-property('registry', 'gov:/xml/body.xml')" type="OM" />
<property name="xmlfile" expression="get-property('registry', 'gov:/xml/body.xml')" type="OM" />
<enrich>
<source clone="true" xpath="get-property('xmlfile')" />
<target type="body" />
</enrich>
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="JsonSplitterBlog"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<payloadFactory media-type="json">
{
"users":[
{"name":"X", "age":"10"},
{"name":"Y", "age":"12"},
{"name":"Z","age":"15"}
]
}