Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Ws Wiki" for change 
notification.

The following page has been changed by jaxc:
http://wiki.apache.org/ws/jaxc

New page:
= JSON Support for Axis2/C =

Synopsis

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 wi
 re. 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 JavaS
 cript 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

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to