axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sagara Gunathunga (Commented) (JIRA)" <>
Subject [jira] [Commented] (AXIS2-5158) Improve JSON support in Axis2
Date Tue, 04 Oct 2011 09:08:34 GMT


Sagara Gunathunga  commented on AXIS2-5158:

Other than above MessageReceiver limitation current JSON support perform number of extra XML/JSON
conventions in both client and server sides in order to match with existing Axis2 architecture.
The proper solution would be serialize/deserialize  JSON to Java objects and back again directly
but this required some refactoring , google-gson [1] can be a good framework for this propose
with it's performance and streaming support.

BTW as a short term solution we can include your modification to work with RPCMessageReceivers.
It's bit of difficult task to review raw source files instead  can you please provide your
modification as a svn patch file for Axis2 trunk.  It Would be great if you can provide a
unit test for this too . 

[1] -
> Improve JSON support in Axis2
> -----------------------------
>                 Key: AXIS2-5158
>                 URL:
>             Project: Axis2
>          Issue Type: Improvement
>          Components: json
>    Affects Versions: 1.6.1
>            Reporter: Paul Hodchenkov
>         Attachments:,,,,,,
> RawXMLInOutMessageReceiver can be only used in JSON services now [1].
> However, JSON/badgerfish builder can be improved by handling RPCMessageReceiver correctly.
I can't attach the patch because i have copy pasted and created my own formatters and builders(please
find the source attached):
> 1) It is possible to solve the namespace problem described at [1] by explicitly converting
JSON/badgerfish to SOAP in JSONbadgerfish builder :
> public OMElement processDocument(InputStream inputStream, String contentType,
> MessageContext messageContext) throws AxisFault {
> ....
> AbstractXMLInputFactory inputFactory = new BadgerFishXMLInputFactory();
> XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(
> new JSONTokener(IOUtils.toString(reader)));
> OMNodeEx document = (OMNodeEx) new StAXOMBuilder(xmlReader).getDocumentElement();
> //removing parent
> document.setParent(null);
> //wrapping document with envelope
> SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();
> SOAPEnvelope soapEnvelope = soapFactory.getDefaultEnvelope();
> SOAPBody body = soapEnvelope.getBody();
> body.addChild(document);
>  //converting xml structure to soap xml structure,
> //this operation will construct SoapEnvelope,SoapBody,SoapFault instead of
> //regular OmElement
> StAXSOAPModelBuilder stAXSOAPModelBuilder = new StAXSOAPModelBuilder(soapEnvelope.getXMLStreamReader(),
> return stAXSOAPModelBuilder.getSOAPEnvelope();
> ...
> }
> 2) jettison 1.2 has cool feature called setIgnoreNamespaces which allows to use json
formatter with any xml.
> We use the these builders and formatters successfully with JSON/badgerfish request and
JSON response.
> [1]

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message