Return-Path: X-Original-To: apmail-axis-java-dev-archive@www.apache.org Delivered-To: apmail-axis-java-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EC98CC967 for ; Fri, 4 May 2012 18:03:10 +0000 (UTC) Received: (qmail 12935 invoked by uid 500); 4 May 2012 18:03:10 -0000 Delivered-To: apmail-axis-java-dev-archive@axis.apache.org Received: (qmail 12799 invoked by uid 500); 4 May 2012 18:03:10 -0000 Mailing-List: contact java-dev-help@axis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@axis.apache.org Delivered-To: mailing list java-dev@axis.apache.org Received: (qmail 12790 invoked by uid 99); 4 May 2012 18:03:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 May 2012 18:03:09 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 May 2012 18:03:08 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 9CDB54306D9 for ; Fri, 4 May 2012 18:02:48 +0000 (UTC) Date: Fri, 4 May 2012 18:02:48 +0000 (UTC) From: "Paul Hodchenkov (JIRA)" To: java-dev@axis.apache.org Message-ID: <1612251293.28099.1336154568644.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1217304338.2190.1317625714055.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (AXIS2-5158) Improve JSON support in Axis2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/AXIS2-5158?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13268586#comment-13268586 ] Paul Hodchenkov commented on AXIS2-5158: ---------------------------------------- P.S in http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONMessageFormatter.java?view=markup on line 176 there is a statement: "Mapped format cannot handle element with namespaces.. So cannot handle Faults". Actually, it may serialize the fault : just need to call setIgnoreNamespaces in mapped jettison message formatter, so client will receive a proper json response for fault instead of plain text string. > Improve JSON support in Axis2 > ----------------------------- > > Key: AXIS2-5158 > URL: https://issues.apache.org/jira/browse/AXIS2-5158 > Project: Axis2 > Issue Type: Improvement > Components: json > Affects Versions: 1.6.1 > Reporter: Paul Hodchenkov > Assignee: Andreas Veithen > Attachments: AbstractJSONBuilder.java, AbstractJSONMessageFormatter.java, ExtendedMappedXMLStreamWriter.java, JSONBadgerfishBuilder.java, JSONBadgerfishMessageFormatter.java, JSONMappedBuilder.java, JSONMessageFormatter.java > > > 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); > soapEnvelope.build(); > //converting xml structure to soap xml structure, > //this operation will construct SoapEnvelope,SoapBody,SoapFault instead of > //regular OmElement > StAXSOAPModelBuilder stAXSOAPModelBuilder = new StAXSOAPModelBuilder(soapEnvelope.getXMLStreamReader(), null); > 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] http://isurues.wordpress.com/2009/10/06/how-to-use-axis2-json/ -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org For additional commands, e-mail: java-dev-help@axis.apache.org