I'm trying to leverage the callout mediator to call a REST endpoint.
But I need to send the contents of a received HTTP header.
I tried:
<callout passHeaders="false">
<endpoint>
<address uri="http://localhost:8888/test"></address>
</endpoint>
<source xpath="$trp:X-custom-header" />
</callout>
But this failed with:
ERROR - CalloutMediator The evaluation of the XPath expression : $trp:X-custom-header did not result in an OMElement
Is it even possible?
If your header is already available via the $trp scope it should be sent to your endpoint just fine.
If it's not set yet your can set it via the header mediator or the property mediator like so:
If you need form data like mentioned below you will need to use the payload mediator to create a payload and set the messagetype to multipart/form-data (You might need to enable an extra formatter in the axis2.xml for this)
Payload: