WSO2 Advantage Webinar - JSON Support in the WSO2 Platform
WSO2 Advantage Webinar - JSON Support in the WSO2 Platform Ishan Jayawardena Software Engineer
About WSO2• Providing the only complete open source componentized cloud platform Dedicated to removing all the stumbling blocks to enterprise agility Enabling you to focus on business logic and business value• Recognized by leading analyst firms as visionaries and leaders Gartner cites WSO2 as visionaries in all 3 categories of application infrastructure Forrester places WSO2 in top 2 for API Management• Global corporation with offices in USA, UK & Sri Lanka 200+ employees and growing• Business model of selling comprehensive support & maintenance for our products
JSON Support in WSO2 Platform● Message Builders and Message Formatters● Constructing, and processing payloads JSON, and XML with Script mediator● Converting message type between JSON and XML
Message Builders and Formatters● What do they do?
Message Builders and Formatters● What message builders and formatters are available for JSON?● Builds XML infoset org.apache.axis2.json.JSONBuilder. org.apache.axis2.json.JSONMessageFormatter● Process as JSON org.apache.axis2.json.JSONStreamBuilder org.apache.axis2.json.JSONStreamFormatter● How to configure Register Builder/Formatter in ESB_HOME/repository/conf/axis2/axis2.xml <messageBuilder contentType="application/json" class="org.apache.axis2.json.JSONStreamBuilder"/> <messageFormatter contentType="application/json" class="org.apache.axis2.json.JSONStreamFormatter"/>
Converting between XML and JSON● Script mediator functionsXML:mc.toXMLPayload(jsonObject, [content-type])<script language="js"><![CDATA[ var jsonResponse = mc.getPayloadJSON() mc.toXMLPayload(jsonResponse);]]></script>JSON:mc.toJSONPayload(xmlObject, [content-type])<script language="js"><![CDATA[ var xmlResponse = mc.getPayloadXML() mc.toJSONPayload(xmlResponse);]]></script>
Engage with WSO2• Helping you get the most out of your deployments• From project evaluation and inception to development and going into production, WSO2 is your partner in ensuring 100% project success
A particular slide catching your eye?
Clipping is a handy way to collect important slides you want to go back to later.