I'm trying to create a WSO2 ESB proxy that would generate an HTTP multipart response, basically with 2 parts: XML and an attached binary file (an image for example). The sequence would be as follow:
- the service is exposed as an HTTP GET request
- we first call an endpoint that returns a binary file
- we create an XML that describe the binary file
- we mix the 2 elements together and provide the multipart response (XML + binary file)
After several attempts and looking around on samples and forums I couldn't find how to solve this particular case. I've managed to call the endpoint. I can see in the debug logs that the response is transferred as binary in the soap internal message. I suspect I then need to use the MultipartFormDataFormatter. As far as I understand the code of the formatter, it takes all the child nodes of the body of the internal soap message to create one part by child.
So I've tried to append my XML content as a sibling node of the binary node (the message looks as expected in the logs), and force the ContentType with :
<property name="messageType" value="multipart/form-data" scope="axis2"/>
<property name="ContentType" value="multipart/form-data" scope="axis2"/>
to be sure to call the correct formatter.
Unfortunately this does not seem to work, the response is indeed in multipart/form-data, but with zero bytes data.
Any help?
Thanks Yannick