Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.6.1
-
None
-
None
Description
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/
Attachments
Attachments
Issue Links
- is blocked by
-
AXIOM-399 Allow creation of OMSourcedElements with unknown local name and namespace URI
- Resolved