bontade bontade - 3 months ago 27
reST (reStructuredText) Question

wso2esb - redundant headers from HTTP request

I have written a simple proxy in WSO2 ESB to just handle HTTP request and send message to RabbitMQ queue.
Here's my proxy service:

<?xml version="1.0" encoding="UTF-8"?>
<proxy name="TestProxy" startOnLoad="true" transports="https http" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<header action="remove" name="Accept" scope="transport"/>
<property action="remove" name="SOAP_ACTION" scope="default"/>
<property action="remove" name="SOAP_ACTION" scope="transport"/>
<property action="remove" name="SOAP_ACTION" scope="axis2"/>
<property action="remove" name="SOAPAction" scope="default"/>
<property action="remove" name="SOAPAction" scope="transport"/>
<property action="remove" name="SOAPAction" scope="axis2"/>
<header action="remove" name="Action" scope="default"/>
<header action="remove" name="Action" scope="transport"/>
<property name="transport.jms.ContentTypeProperty" scope="axis2" type="STRING" value="Content-Type2"/>
<property name="FORCE_SC_ACCEPTED" scope="axis2" type="STRING" value="true"/>
<property name="NO_ENTITY_BODY" action="remove" scope="axis2"/>

<property name="messageType" value="application/json" scope="axis2"/>

<property name="CONTENT_TYPE" value="application/json" scope="axis2"/>
<property name="OUT_ONLY" scope="default" type="STRING" value="true" />

<payloadFactory media-type="json">
<format>{"test": "test2"}</format>
<args>
</args>
</payloadFactory>
<send>
<endpoint>
<address trace="disable"
uri="rabbitmq:/TestProxy?rabbitmq.server.host.name=localhost&amp;rabbitmq.server.port=5672&amp;rabbitmq.server.user.name=test&amp;rabbitmq.server.password=test&amp;rabbitmq.queue.name=inputQueue_001&amp;rabbitmq.exchange.name=amq.direct&amp;rabbitmq.queue.routing.key=inputQueue_001&amp;rabbitmq.message.content.type=application/json"/>
</endpoint>
</send>

</inSequence>
<outSequence>
<header action="remove" name="Accept" scope="transport"/>
<property action="remove" name="SOAP_ACTION" scope="default"/>
<property action="remove" name="SOAP_ACTION" scope="transport"/>
<property action="remove" name="SOAP_ACTION" scope="axis2"/>
<property action="remove" name="SOAPAction" scope="default"/>
<property action="remove" name="SOAPAction" scope="transport"/>
<property action="remove" name="SOAPAction" scope="axis2"/>
<header action="remove" name="Action" scope="default"/>
<header action="remove" name="Action" scope="transport"/>
<property name="NO_ENTITY_BODY" action="remove" scope="axis2"/>
<send></send>
</outSequence>
<faultSequence/>
</target>
</proxy>


From few days I am struggling with removing headers from message send to queue.
Here's my message on inputQueue_001:

enter image description here

and I have no idea how to remove all headers...

Do you have any clues???

I will appreciate any help and examples.

Answer

All transport headers are saved in axis2 message context, in a property named TRANSPORT_HEADERS : delete it before send mediator

<property action="remove" name="TRANSPORT_HEADERS" scope="axis2"/>