+1 very nicely thought thru! You may also want to review how ADB serializes
Java onto the wire without going to an in-memory XML form first .. you
should be able to do something similar for JSON.

Sanjiva.

On Mon, Dec 26, 2011 at 11:19 AM, Amila Suriarachchi <
amilasuriarach...@gmail.com> wrote:

> looks good.
>
> thanks,
> Amila.
>
>
> On Sun, Dec 25, 2011 at 7:39 PM, Shameera Rathnayaka <
> shameerai...@gmail.com> wrote:
>
>> Hi devs,
>>
>> I hope to select an axis2 related project to do in 2012 GSOC. Therefore i
>> did some basic research about Axis2 and found that Current Json support in
>> Axis2 can be improved using a rich library such as google-gson to use
>> normal JSON object to communicate with java services without converting it
>> to Badgerfish.
>>
>> Here is my proposal in brief.
>>
>> There are two ways that xml string can be converted into JSON string,
>> Badgerfish and Mapped . Current Axis2 with JSON module completely supports
>> Badgerfish convention[1] while partialy supports Mapped convention[1] as
>> Mapped formatted JSON with namespaces are not supported in Axis2. Therefore
>> if the client side java-script code needs to talk with java service which
>> is deployed in Axis2, it should be sent as Badgerfish convention. It is
>> cumbersome to generate Badgerfish convention of JSON string again and again
>> to call services if there is no  xml representation string in client side.
>>
>> If java script client can send JSON object to relevant java service in
>> Axis2, defining service and operation in request url, without doing any
>> modifications to JSON objects, then it would be very helpful for
>> Java-Script users at client side.
>>
>> Here i propose a solution to implement this with some limitations by
>> using google-gson [2] <http://code.google.com/p/google-gson/> library
>> which is a rich library to convert JSON string to Java object and
>> vice-versa and also it is released under Apache license. Using this library
>> we can improve JSON support in Axis2 to overcome above problem. Following
>> are some advantages of using gson to convert JSON to Java object and
>> vice-versa.
>>
>>    - Provide simple toJson() and fromJson() methods to convert Java
>>    objects to JSON and vice-versa
>>    - Allow pre-existing unmodifiable objects to be converted to and from
>>    JSON
>>    - Extensive support of Java Generics
>>    - Allow custom representations for objects
>>    - Support arbitrarily complex objects (with deep inheritance
>>    hierarchies and extensive use of generic types)
>>
>> As i mentioned there are several limitations because we are not using
>> namespace mapping. As an example if wsdl has two methods with same name but
>> different namespace then this method will fail,But there are ways we can
>> find a solution to fix this to some extent.
>>
>> Also i have some basic idea about how to implement this improvement, as
>> follows. Here i have assumed that service name and operation name can be
>> read from request URL. Then incoming message can be dispatched to correct
>> operation.
>>
>>
>> 1. write a jsonMessagebuilder to read incoming json string under specific
>> content type.
>>
>> 2. store json string without doing any process untill it reaches
>> JsonMessageReceiver. JsonMessageReceiver is a new Message Receiver which
>> use gson to convert json to java objects, call relevant operation and get
>> result.
>>
>>
>> 3. write a jsonMessageFormatter to write output stream according to
>> content type.
>>
>>
>> I would like to know that whether this is a good idea and will it be
>> allright to do this as GSOC project.
>>
>> [1]http://wso2.org/library/768 <http://wso2.org/library/768>
>> [2]http://code.google.com/p/google-gson/<http://code.google.com/p/google-gson/>
>>
>> Thanks
>> Shameera.
>>
>> --
>> Shameera Rathnayaka
>> Undergraduate
>> Department of Computer Science and Engineering
>> University of Moratuwa.
>> Sri Lanka.
>>
>> Blog : http://shameerarathnayaka.blogspot.com/
>>
>>
>
>
> --
> Amila Suriarachchi
> WSO2 Inc.
> blog: http://amilachinthaka.blogspot.com/
>



-- 
Sanjiva Weerawarana, Ph.D.
Founder, Director & Chief Scientist; Lanka Software Foundation;
http://www.opensource.lk/
Founder, Chairman & CEO; WSO2; http://wso2.com/
Founder & Director; Thinkcube Systems; http://www.thinkcube.com/
Member; Apache Software Foundation; http://www.apache.org/
Visiting Lecturer; University of Moratuwa; http://www.cse.mrt.ac.lk/

Blog: http://sanjiva.weerawarana.org/

Reply via email to