1. Vanjikumar Sivajothy
Senior Software Engineer
Ishan Jayawardena
Senior Software Engineer
February 20 2014
WSO2 Advantage Webinar
Improved JSON support of WSO2 ESB 4.8.0
2. 2
About the Presenters
Vanjikumar Sivajothy vanji@wso2.com
Senior Software Engineer
Vanji joined WSO2 in February 2013. He is a Senior Software Engineer in the WSO2 Enterprise Service Bus product
team. In addition to his product development efforts he has also provided technology consulting on customer
engagements, including development service programs.
Ishan Jayawardena ishan@wso2.com
Senior Software Engineer
Ishan joined WSO2 in December 2011. He is a software engineer in the integration technologies team where he
mainly focuses on the WSO2 Enterprise Service Bus. In addition to his product development efforts he has also
provided technology consulting on customer engagements, including customer QuickStart programs focused on
Enterprise Application Integration projects.
3. 3
About WSO2
๏ Global enterprise, founded in 2005
by acknowledged leaders in XML,
web services technologies,
standards and open source
๏ Provides only open source
platform-as-a-service for private,
public and hybrid cloud
deployments
๏ All WSO2 products are 100% open
source and released under the
Apache License Version 2.0.
๏ Is an Active Member of OASIS,
Cloud Security Alliance, OSGi
Alliance, AMQP Working Group,
OpenID Foundation and W3C.
๏ Driven by Innovation
๏ Launched first open source API
Management solution in 2012
๏ Launched App Factory in 2Q
2013
๏ Launched Enterprise Store and
first open source Mobile
solution in 4Q 2013
๏ Generated 2x revenue growth in
2013 and 2012
๏ Captured 65 new customers in
2013
๏ Obtained $20 M of funding from
CISCO and Toba Capital
5. Agenda
5
JSON
JSON Support of WSO2 ESB 4.8.0
Developing JSON aware message flows with ESB 4.8.0
Accessing content of JSON messages
Content Based Routing (CBR) for JSON messages
Constructing, and Transforming JSON
Logging, and Troubleshooting
6. 6
JSON
A data interchange format that is,
๏ Lightweight
๏ Text-based
๏ Language independent
๏ Human/machine readable
A better data interchange format
JSON and JavaScript
Internet Media type
๏ application/json
7. 7
JSON Support of WSO2 ESB
Message Builders, and Message Formatters
๏ Builder, Formatter
Register builder formatter in ESB_HOME/repository/conf/axis2/axis2.xml
<messageBuilder contentType="application/json"
class="org.apache.synapse.commons.json.JsonStreamBuilder"/>
<messageFormatter contentType="application/json"
class="org.apache.synapse.commons.json.JsonStreamFormatter"/>
๏ StAXON
๏ Deferred Building
๏ Efficient
8. 8
JSON Support of WSO2 ESB
JSONPath
๏ Log, Property, Switch, Filter
PayloadFactory, Script Mediators
๏ Construct, transform JSON
Convert between JSON and XML
<property name="messageType" value="application/json" scope="axis2"/>
<property name="messageType" value="application/xml" scope="axis2"/>
Better XML representation of JSON requests
๏ Minimum information loss
๏ Supports complex JSON structures
๏ Supports special characters
Documentation
http://docs.wso2.org/display/ESB481/JSON+Support
9. 9
Accessing JSON Content
Accessing Content of a JSON payload
๏ JSONPath
json-eval()
๏ XPath
13. 13
Logging - JSON payload
๏ Log the entire payload using Log Mediator for JSON payload
๏ Full payload log in XML using Log Mediator
14. 14
Constructing JSON Payloads
PayloadFactory Mediator
Well defined payload
Known structure for payload
Script Mediator
Recurring Structure like Array
15. 15
Constructing JSON - Payload
๏ The PayloadFactory mediator provides the simplest way to work with JSON payload
16. 16
Constructing JSON - Script
๏ The Script mediator provides the flexibility for handle recurring structures such as arrays