I ain't able to convert json in XML -
i relative new in wso2 , having little problems. asked here, how make conversion, , able in moment. tried same code passed stack overflow:
<?xml version="1.0" encoding="utf-8"?> <api context="/test" name="jsontoxmlapi" xmlns="http://ws.apache.org/ns/synapse"> <resource methods="post" uri-template="/xml/"> <insequence> <property name="messagetype" scope="axis2" type="string" value="text/xml"/> <header action="remove" name="to" scope="default"/> <property name="response" scope="default" type="string" value="true"/> <send/> </insequence> <outsequence/> <faultsequence/> </resource> </api>
and send equal request, of taught before:
but receiving error:
error - passthroughhttpsender failed submit response org.apache.axis2.axisfault: can not output xml declaration, after other output has been done. @ org.apache.axis2.axisfault.makefault(axisfault.java:430) @ org.apache.axis2.transport.http.soapmessageformatter.writeto(soapmessageformatter.java:78) @ org.apache.synapse.transport.passthru.passthroughhttpsender.submitresponse(passthroughhttpsender.java:555) @ org.apache.synapse.transport.passthru.passthroughhttpsender.invoke(passthroughhttpsender.java:264) @ org.apache.axis2.engine.axisengine.send(axisengine.java:442) @ org.apache.synapse.core.axis2.axis2sender.sendback(axis2sender.java:222) @ org.apache.synapse.core.axis2.axis2synapseenvironment.send(axis2synapseenvironment.java:531) @ org.apache.synapse.mediators.builtin.sendmediator.mediate(sendmediator.java:118) @ org.apache.synapse.mediators.abstractlistmediator.mediate(abstractlistmediator.java:97) @ org.apache.synapse.mediators.abstractlistmediator.mediate(abstractlistmediator.java:59) @ org.apache.synapse.mediators.base.sequencemediator.mediate(sequencemediator.java:158) @ org.apache.synapse.rest.resource.process(resource.java:343) @ org.apache.synapse.rest.api.process(api.java:399) @ org.apache.synapse.rest.restrequesthandler.apiprocess(restrequesthandler.java:123) @ org.apache.synapse.rest.restrequesthandler.dispatchtoapi(restrequesthandler.java:101) @ org.apache.synapse.rest.restrequesthandler.process(restrequesthandler.java:69) @ org.apache.synapse.core.axis2.axis2synapseenvironment.injectmessage(axis2synapseenvironment.java:304) @ org.apache.synapse.core.axis2.synapsemessagereceiver.receive(synapsemessagereceiver.java:75) @ org.apache.axis2.engine.axisengine.receive(axisengine.java:180) @ org.apache.synapse.transport.passthru.serverworker.processnonentityenclosingresthandler(serverworker.java:325) @ org.apache.synapse.transport.passthru.serverworker.processentityenclosingrequest(serverworker.java:371) @ org.apache.synapse.transport.passthru.serverworker.run(serverworker.java:151) @ org.apache.axis2.transport.base.threads.nativeworkerpool$1.run(nativeworkerpool.java:172) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ java.lang.thread.run(thread.java:745) caused by: javax.xml.stream.xmlstreamexception: can not output xml declaration, after other output has been done. @ com.ctc.wstx.sw.basestreamwriter.throwoutputerror(basestreamwriter.java:1522) @ com.ctc.wstx.sw.basestreamwriter.reportnwfstructure(basestreamwriter.java:1551) @ com.ctc.wstx.sw.basestreamwriter.dowritestartdocument(basestreamwriter.java:650) @ com.ctc.wstx.sw.basestreamwriter.writestartdocument(basestreamwriter.java:638) @ com.ctc.wstx.sw.basestreamwriter.writestartdocument(basestreamwriter.java:626) @ org.apache.axiom.om.impl.mtomxmlstreamwriter.writestartdocument(mtomxmlstreamwriter.java:277) @ org.apache.synapse.commons.json.jsondatasource.serialize(jsondatasource.java:88) @ org.apache.axiom.om.impl.llom.omsourcedelementimpl.internalserialize(omsourcedelementimpl.java:691) @ org.apache.axiom.om.impl.util.omserializerutil.serializechildren(omserializerutil.java:562) @ org.apache.axiom.om.impl.llom.omelementimpl.internalserialize(omelementimpl.java:875) @ org.apache.axiom.soap.impl.llom.soapenvelopeimpl.serializeinternally(soapenvelopeimpl.java:283) @ org.apache.axiom.soap.impl.llom.soapenvelopeimpl.internalserialize(soapenvelopeimpl.java:245) @ org.apache.axiom.om.impl.llom.omserializableimpl.serializeandconsume(omserializableimpl.java:193) @ org.apache.axis2.transport.http.soapmessageformatter.writeto(soapmessageformatter.java:74) ... 24 more [2017-07-25 15:35:50,646] error - axis2sender accept:*/*,accept-encoding:gzip, deflate, br,accept-language:pt-br,pt;q=0.8,en-us;q=0.6,en;q=0.4,cache-control:no-cache,content-type:application/soap+xml,host:localhost:8280,origin:chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop,postman-token:89253418-6c05-c959-5e21-2ce7555e0cb6,<?xml version='1.0' encoding='utf-8'?><soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:body><jsonobject><location_response><name>cafe</name><tags>dsdsd</tags></location_response></jsonobject></soapenv:body></soapenv:envelope> unexpected error sending message org.apache.axis2.axisfault: failed submit response @ org.apache.synapse.transport.passthru.passthroughhttpsender.handleexception(passthroughhttpsender.java:613) @ org.apache.synapse.transport.passthru.passthroughhttpsender.invoke(passthroughhttpsender.java:266) @ org.apache.axis2.engine.axisengine.send(axisengine.java:442) @ org.apache.synapse.core.axis2.axis2sender.sendback(axis2sender.java:222) @ org.apache.synapse.core.axis2.axis2synapseenvironment.send(axis2synapseenvironment.java:531) @ org.apache.synapse.mediators.builtin.sendmediator.mediate(sendmediator.java:118) @ org.apache.synapse.mediators.abstractlistmediator.mediate(abstractlistmediator.java:97) @ org.apache.synapse.mediators.abstractlistmediator.mediate(abstractlistmediator.java:59) @ org.apache.synapse.mediators.base.sequencemediator.mediate(sequencemediator.java:158) @ org.apache.synapse.rest.resource.process(resource.java:343) @ org.apache.synapse.rest.api.process(api.java:399) @ org.apache.synapse.rest.restrequesthandler.apiprocess(restrequesthandler.java:123) @ org.apache.synapse.rest.restrequesthandler.dispatchtoapi(restrequesthandler.java:101) @ org.apache.synapse.rest.restrequesthandler.process(restrequesthandler.java:69) @ org.apache.synapse.core.axis2.axis2synapseenvironment.injectmessage(axis2synapseenvironment.java:304) @ org.apache.synapse.core.axis2.synapsemessagereceiver.receive(synapsemessagereceiver.java:75) @ org.apache.axis2.engine.axisengine.receive(axisengine.java:180) @ org.apache.synapse.transport.passthru.serverworker.processnonentityenclosingresthandler(serverworker.java:325) @ org.apache.synapse.transport.passthru.serverworker.processentityenclosingrequest(serverworker.java:371) @ org.apache.synapse.transport.passthru.serverworker.run(serverworker.java:151) @ org.apache.axis2.transport.base.threads.nativeworkerpool$1.run(nativeworkerpool.java:172) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ java.lang.thread.run(thread.java:745) caused by: org.apache.axis2.axisfault: can not output xml declaration, after other output has been done. @ org.apache.axis2.axisfault.makefault(axisfault.java:430) @ org.apache.axis2.transport.http.soapmessageformatter.writeto(soapmessageformatter.java:78) @ org.apache.synapse.transport.passthru.passthroughhttpsender.submitresponse(passthroughhttpsender.java:555) @ org.apache.synapse.transport.passthru.passthroughhttpsender.invoke(passthroughhttpsender.java:264) ... 22 more caused by: javax.xml.stream.xmlstreamexception: can not output xml declaration, after other output has been done. @ com.ctc.wstx.sw.basestreamwriter.throwoutputerror(basestreamwriter.java:1522) @ com.ctc.wstx.sw.basestreamwriter.reportnwfstructure(basestreamwriter.java:1551) @ com.ctc.wstx.sw.basestreamwriter.dowritestartdocument(basestreamwriter.java:650) @ com.ctc.wstx.sw.basestreamwriter.writestartdocument(basestreamwriter.java:638) @ com.ctc.wstx.sw.basestreamwriter.writestartdocument(basestreamwriter.java:626) @ org.apache.axiom.om.impl.mtomxmlstreamwriter.writestartdocument(mtomxmlstreamwriter.java:277) @ org.apache.synapse.commons.json.jsondatasource.serialize(jsondatasource.java:88) @ org.apache.axiom.om.impl.llom.omsourcedelementimpl.internalserialize(omsourcedelementimpl.java:691) @ org.apache.axiom.om.impl.util.omserializerutil.serializechildren(omserializerutil.java:562) @ org.apache.axiom.om.impl.llom.omelementimpl.internalserialize(omelementimpl.java:875) @ org.apache.axiom.soap.impl.llom.soapenvelopeimpl.serializeinternally(soapenvelopeimpl.java:283) @ org.apache.axiom.soap.impl.llom.soapenvelopeimpl.internalserialize(soapenvelopeimpl.java:245) @ org.apache.axiom.om.impl.llom.omserializableimpl.serializeandconsume(omserializableimpl.java:193) @ org.apache.axis2.transport.http.soapmessageformatter.writeto(soapmessageformatter.java:74) ... 24 more
i searched in internet , in stackoverflow, none of resolutions used problem, solved in case. if me stay quite grateful.
thank everyone.
i can response api without error. try "application/xml" in api instead of "text/xml".
<property name="messagetype" value="application/xml" scope="axis2" type="string"/>
Comments
Post a Comment