How to extract the file upload content in SOA-P 5 using HttpGateway?

Solution Unverified - Updated -


  • Here is an HttpGateway ESB action defined.
      <service category="Vehicles" name="Cars" description="" invmScope="GLOBAL">
            <http-gateway name="Http" urlPattern="esb-cars/*" payloadAs="BYTES"/>
        <actions mep="RequestResponse">
          <action name="HttpAction" class="org.jboss.soa.esb.samples.quickstart.httpgateway.MAction"/>

This is working fine. It helps users to upload a file to the ESB action using the following HTML.

    <form action="http://localhost:8080/Quickstart_http_gateway/http/esb-cars/hello"
          enctype="multipart/form-data" method="post">
      <p>Please specify a file, or a set of files:<br>
      <input type="file" name="datafile" size="40">
      <div><input type="submit" value="Send"></div>

The problem arises during extracting the file contents from the message during the following invocation.

    byte[] content = (byte[])message.getBody().get();

It gives the following result.

    Content-Disposition: form-data; name="datafile"; filename="myfile"
    Content-Type: application/octet-stream
    This is a test file.


Is there a way to extract only the part of the http request that has the file contents?


  • Red Hat JBoss SOA Platform (SOA-P)
    • 5.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In