1

I am trying to build a simple POC using wso2ESB. I've created a simple pass through proxy service with an Alfresco service http://www.alfresco.com/

The problem is I am not getting the full JSON data. I've read it has something to do with the axis2-JSON and that it causes problems when one has JSONArray in the root. So I've decided to use message relay.

WSO2 ESB Unable to convert complete JSON data to XML

I've edited the axis2.xml as described in the documentation thus adding the following lines

<messageFormatter contentType="application/json"
                        class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>

and

<messageBuilder contentType="application/xml"
                class="org.apache.axis2.builder.ApplicationXMLBuilder"/>

But after I've restarted the server when I try to use the proxy server through the firefox REST plugin the ESB throws the following exception

    [2012-07-12 10:02:29,125]  WARN - ClientWorker Unexpected response received. HTTP response co
de : 405 HTTP status : Method Not Allowed exception : SOAP message MUST NOT contain a Documen
t Type Declaration(DTD)
[2012-07-12 10:02:29,125] ERROR - NativeWorkerPool Uncaught exception
java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMTextImpl cannot be cast to org.
apache.axiom.om.OMElement
        at org.apache.synapse.util.MessageHelper.cloneSOAPFault(MessageHelper.java:441)
        at org.apache.synapse.util.MessageHelper.cloneSOAPEnvelope(MessageHelper.java:254)
        at org.apache.synapse.core.axis2.SOAPUtils.convertSOAP11toSOAP12(SOAPUtils.java:95)
        at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbac
kReceiver.java:323)
        at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackRecei
ver.java:160)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
        at org.apache.synapse.transport.nhttp.ClientWorker.run(ClientWorker.java:275)
        at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.ja
va:173)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886
)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)

What causes this? Is the problem that ESB still tries to convert the JSON object instead of trying to relay it?

Is there another workaround in parsing these JSON objects (i.e. adding artificial root to the JSON object?)

Community
  • 1
  • 1
Ivo
  • 1,228
  • 1
  • 15
  • 33

1 Answers1

1

at the builders you need to set the application/json to use org.wso2.carbon.relay.BinaryRelayBuilder as well.

Amila Suriarachchi
  • 1,228
  • 7
  • 5