Return empty response in REST API in WSO2 ESB -
i have api artifact in wso2 esb 4.9.0 offering simple put rest service.
the put service simplified here log of incoming request , should respond http code 200 without content.
this api resource:
<api xmlns="http://ws.apache.org/ns/synapse" name="myapi" context="/context"> <resource methods="put" uri-template="/resource"> <insequence> <log level="custom"> <property name="put" value="/v1/updateworkflowdata" /> </log> <property name="no_entity_body" value="true" scope="axis2" /> <property name="http_sc" value="200" scope="axis2" /> <respond /> </insequence> </resource> </api>
with property "no_entity_body" true (which being used in requests) following exception:
[2016-06-28 12:27:27,524] error - passthroughhttpsslsender failed submit response java.lang.classcastexception: java.lang.string cannot cast java.lang.boolean @ org.apache.synapse.transport.passthru.passthroughhttpsender.submitresponse(passthroughhttpsender.java:468) @ org.apache.synapse.transport.passthru.passthroughhttpsender.invoke(passthroughhttpsender.java:267) @ org.apache.axis2.engine.axisengine.send(axisengine.java:442) @ org.apache.synapse.core.axis2.axis2sender.sendback(axis2sender.java:212) @ org.apache.synapse.mediators.builtin.respondmediator.mediate(respondmediator.java:28) @ org.apache.synapse.mediators.abstractlistmediator.mediate(abstractlistmediator.java:81) @ org.apache.synapse.mediators.abstractlistmediator.mediate(abstractlistmediator.java:48) @ org.apache.synapse.mediators.base.sequencemediator.mediate(sequencemediator.java:149) @ org.apache.synapse.rest.resource.process(resource.java:297) @ org.apache.synapse.rest.api.process(api.java:378) @ org.apache.synapse.rest.restrequesthandler.dispatchtoapi(restrequesthandler.java:97) @ org.apache.synapse.rest.restrequesthandler.process(restrequesthandler.java:65) @ org.apache.synapse.core.axis2.axis2synapseenvironment.injectmessage(axis2synapseenvironment.java:266) @ org.apache.synapse.core.axis2.synapsemessagereceiver.receive(synapsemessagereceiver.java:83) @ org.apache.axis2.engine.axisengine.receive(axisengine.java:180) @ org.apache.synapse.transport.passthru.serverworker.processnonentityenclosingresthandler(serverworker.java:317) @ org.apache.synapse.transport.passthru.serverworker.processentityenclosingrequest(serverworker.java:363) @ org.apache.synapse.transport.passthru.serverworker.run(serverworker.java:142) @ org.apache.axis2.transport.base.threads.nativeworkerpool$1.run(nativeworkerpool.java:172) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615) @ java.lang.thread.run(thread.java:745) [2016-06-28 12:27:27,555] error - axis2sender accept-encoding:gzip,deflate,content-type:application/json,host:localhost:8243,<?xml version='1.0' encoding='utf-8'?><soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:body/></soapenv:envelope> unexpected error sending message org.apache.axis2.axisfault: failed submit response @ org.apache.synapse.transport.passthru.passthroughhttpsender.handleexception(passthroughhttpsender.java:610) @ org.apache.synapse.transport.passthru.passthroughhttpsender.invoke(passthroughhttpsender.java:269) @ org.apache.axis2.engine.axisengine.send(axisengine.java:442) @ org.apache.synapse.core.axis2.axis2sender.sendback(axis2sender.java:212) @ org.apache.synapse.mediators.builtin.respondmediator.mediate(respondmediator.java:28) @ org.apache.synapse.mediators.abstractlistmediator.mediate(abstractlistmediator.java:81) @ org.apache.synapse.mediators.abstractlistmediator.mediate(abstractlistmediator.java:48) @ org.apache.synapse.mediators.base.sequencemediator.mediate(sequencemediator.java:149) @ org.apache.synapse.rest.resource.process(resource.java:297) @ org.apache.synapse.rest.api.process(api.java:378) @ org.apache.synapse.rest.restrequesthandler.dispatchtoapi(restrequesthandler.java:97) @ org.apache.synapse.rest.restrequesthandler.process(restrequesthandler.java:65) @ org.apache.synapse.core.axis2.axis2synapseenvironment.injectmessage(axis2synapseenvironment.java:266) @ org.apache.synapse.core.axis2.synapsemessagereceiver.receive(synapsemessagereceiver.java:83) @ org.apache.axis2.engine.axisengine.receive(axisengine.java:180) @ org.apache.synapse.transport.passthru.serverworker.processnonentityenclosingresthandler(serverworker.java:317) @ org.apache.synapse.transport.passthru.serverworker.processentityenclosingrequest(serverworker.java:363) @ org.apache.synapse.transport.passthru.serverworker.run(serverworker.java:142) @ org.apache.axis2.transport.base.threads.nativeworkerpool$1.run(nativeworkerpool.java:172) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615) @ java.lang.thread.run(thread.java:745) caused by: java.lang.classcastexception: java.lang.string cannot cast java.lang.boolean @ org.apache.synapse.transport.passthru.passthroughhttpsender.submitresponse(passthroughhttpsender.java:468) @ org.apache.synapse.transport.passthru.passthroughhttpsender.invoke(passthroughhttpsender.java:267) ... 20 more
my question now:
- general: how set response empty when request contain content?
- is solution "no_entity_body" wrong , not work?
1) can use script mediator replace response body empty string. there other ways too. script mediator option.
2) "no_entity_body
" used specify expect response request not have body. example request.
Comments
Post a Comment