Saturday 15 September 2012

wso2esb - Create a multipart response with WSO2 ESB -


I am trying to create a WSO2 ESB proxy which will generate a HTTP multilanguage response, basically with 2 parts : XML and an attached binary file (for example an image)

  • This sequence will be followed as follows:
    • The service appeared as an HTTP GET request
    • We first call an endpoint that gives a binary file
    • We create an XML file that is binary
    • We combine 2 elements together and provide multilateral feedback (XML + binary file)

      After several attempts and looking around At samples and forums, I could not find a way to solve this particular case. I have succeeded in calling the endpoint, I can see in the debug log that the reaction is transferred to the soap internal message as a binary. I suspect that I need to use MultipartFormDataFormatter then. As far as I understand the formatter code, all children of the internal soap message body take nodes to make the child a part.

      So I have tried to add my XML content to a binary node (looks as expected in the message log), and force ContentType with it:

       < Code> & lt; Property name = "messageType" value = "multipart / form-data" scope = "axis 2" /> & Lt; Property Name = "ContentTip" value = "Multipart / Form-Data" Scope = "Axis 2" />   

      Be sure to call the correct formatter.

      Unfortunately this does not seem to work, the response is actually in multipart / form-data, but with zero byte data.

      Any help?

      Thanks Yannick

      You can use multipart / form-data to use axis2 Binary Riley Builders must be enabled in .xml file. Message formatting.

        & lt; MessageBuilder contentType = "multipart / form-data" class = "org.wso2.carbon.relay.BinaryRelayBuilder" /> & Lt; MessageFormatter contentType = "Multipart / Form-Data" class = "org.wso2.carbon.relay.ExpandingMessageFormatter" />    

  • No comments:

    Post a Comment