Differences between revisions 1 and 2
Revision 1 as of 2007-04-21 04:31:30
Size: 7441
Editor: GSOC2007
Revision 2 as of 2009-09-20 22:48:30
Size: 7441
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

Google Summer of Code 2007

Proposal for JSON Support for Apache Axis2/C


  • T.G. Kasun Indrasiri



  • Mr. Nandika Jayawardana

Project Title

  • JSON Support for Axis2/C


JSON (JavaScript Object Notation) is a textual data representation format which is similar to XML but much more readable and more lightweight. Axis2C is a web service stack developed for processing and transfer XML messages. But now the idea of using XML for data exchange has extended to use other data exchange formats like JSON.

The main objective of this project is to enable Axis 2/C to consume web services which use JSON as the data transfer format and also to deploy services which uses JSON for communication. JSON can be used for data transfer between hosts using JavaScript because it is understood by JavaScript directly. If Axis 2/C supports JavaScript services then the JSON capability is available for Axis2C it leads to efficient usage of JavaScript services.

The mapping between XML and JSON is a critical factor. The direct mapping between XML and JSON is possible owe to the close relationship between XML and JSON. The conversion from XML to JSON or JSON to XML is pretty straight forward, but the problems arise when we are converting back to the original form from a converted form. In order to refrain from these issues various mapping conventions are used. Since there no standard convention in this process, ‘JSON Support for Axis2/C’ features a couple of most popular standards. The conversions that are going to be supported in this implementation are Badgerfish and Mapped conventions.

Project Deliverables

  • An object model for JSON. This model should be build able from an incoming JSON string and also programmatically.
  • A parser capable of parsing the JSON object model in memory and producing Stax events.
  • Parsers and JSON object serializes for each and every supported conventions.
  • Modify Axis2C internal working so that it can switch between parsers for XML messages and JSON messages.
  • Samples capable of sending and receiving JSON strings (Yahoo has JSON web services API).
  • Appropriate development documentation for continuation of the project and user documentation.

Project Details

The idea of this project is to give Axis2C the capability to populate and consume web services that use JSON. JSON is a textual data representation format like XML. It is based on a subset of the JavaScript Programming Language. JSON is lightweight compare to XML, so it can be used for efficient transfer of data. Axis2C is a web service stack build for transfer of data between nodes. Axis2C uses a XML model called Axiom and Axiom is based on pull parsing of XML (Stax). When a XML message comes to Axis2C it uses a Stax parser to build the Axiom object model in the memory. To consume JSON data inside Axis2C it must be converted to the XML model in Axis2C (Axiom). This can be done by using the JSON parser which produces Stax events and XML data according to the JSON to XML mapping while reading an incoming JSON string. When a service wants to produce JSON data as the output it uses the JSON parser to convert the XML model to JSON string. Then this string will be sent over the wire. Problem with XML and JSON is that there is no direct transformation from XML to JSON. The problem occurs when converting a XML to JSON or JSON to XML and then trying to convert it back to the original. If we stick to the original JSON convention there is no guarantee that this kind of a transformation leads to the original message. To solve this issue various conventions have been adopted by JSON community. There are two such popular conventions, they are

  • Badgerfish convention
  • Mapped convention

It is important to support both these conversions since none of these conventions are standards. For each convention we support, we need to write a separate parser for that. Both the popular conventions do not allow inline parsing of the JSON string and producing STAX events. For example when we convert a XML element to JSON the elements attribute values may appear after the element’s text value in the JSON object. The most efficient way to solve this issue is to construct the JSON object in memory from the given string and then parse this model in the memory to produce Stax events. But this is slow compare to the normal inline parsing of the XML parsers. But with a JSON object constructed in memory before the parsing is done makes development of different JSON to XML mapping conventions easy. The main advantage of JSON binding of Axis2C comes when deploying JavaScript services. Now the work is underway for using Spider Monkey JavaScript engine with Axis2C for hosting JavaScript services. JavaScript can understand JSON, so the incoming JSON can be directly passed to the JavaScript services. Another advantage is that JSON is a lightweight representation. JSON has few limitations, but it can be used for efficient transfer of data in the wire.

Project Plan

My objective is to provide Axis2C, the capability to populate and consume web services that use JSON. As the first step I’m going to implement a JSON object model. After the creation of the JSON object model the implementation of the parsers should be start. In this case there should be two parses to be implemented for each convention. The Badgerfish parser and Mapped parser both has reader and a writer. Thereafter the parses should be integrated with Axis 2/C

Project Schedule

March 24th to April 11th The time since acceptance of projects and start of coding will be spent finalizing the design of the project. This will be done mostly using the Axis2C-dev lists.

April 11th to May 11th Implementation of the JSON object model is done in this period.

May 11th to June 11th Mapped (convention) parser implementation. This includes both the writer and reader implementations for Mapped Convention JSON.

June 11th to July 11th Badgerfish (convention) parser implementation. This includes both the writer and reader implementations for the Badgerfish Convention JSON.

July 11th August 20th Integration of the parsers, with Axis2/C. Writing and testing the test samples. Test samples will be written using an existing JSON web service API.


I’m a Computer Science and Engineering undergraduate in Department of Computer Science and Engineering, University of Moratuwa, Sri Lanka. I have gained considerable amount of experience and knowledge on open source projects during my Software development career. In addition to that I used several open source products in the software development projects that I have involved with. I’m so impressed about the performance and the usability of Apache Software Foundation’s open source projects. It’s a great experience and pleasure to join and contribute to the ASF projects and it would really help me out to shape up my future career.


University of Moratuwa, Sri Lanka. (http://www.mrt.ac.lk)

Computer Science and Engineering Department (http://www.cse.mrt.ac.lk)

JSON: http://www.json.org/

Badgerfish: http://badgerfish.ning.com/

Jettison: http://jettison.codehaus.org/

GSOC2007/JSON_Support_Axis2C (last edited 2009-09-20 22:48:30 by localhost)