title: Http Post multipart file consume apache camel
body: <p>I have already tried <a href="https://stackoverflow.com/questions/54181670/camel-rest-dsl-retrieve-http-post-multipart-file/54207451#54207451">this</a>, <a href="https://stackoverflow.com/questions/2415708/apache-camel-multipart-http-post-file-upload">this</a> &amp; <a href="https://stackoverflow.com/questions/67537409/convert-multipart-body-to-java-object">this</a> so please don't flag this as duplicate.</p>
  <p>I just want an HTTP-POST multipart form that takes a file &amp; consumes it. What I have already tried as per linked answers.</p>
  <pre><code>        from(&quot;rest:POST:/channel/{payment_mode}/bulk/transfer&quot;)
                  .id(&quot;bulk-transfer&quot;)
                  .unmarshal().mimeMultipart() //.split().attachments() 
                  .unmarshal().json(JsonLibrary.Jackson, SimplePojo.class)
                  .log(LoggingLevel.INFO, &quot;## Bulk Transfer&quot;)
                  .process(exchange -&gt; {
                      System.out.println(String.format(&quot;Body:\n%s&quot;, exchange.getIn().getBody(String.class)));
                      Map&lt;String,Attachment&gt; attachments = exchange.getMessage(AttachmentMessage.class).getAttachmentObjects();
                      DataHandler dataHandler = attachments.get(&quot;test.doc&quot;).getDataHandler();
                      System.out.println(String.format(&quot;Attachments: %s&quot;, attachments.size()));
  }).to(&quot;file:src/main/resources/testUpload&quot;);
  </code></pre>
  <p>Error I get on running this:</p>
  <pre><code>05:38:21.781 ERROR [                      XNIO-1 task-1] route10                      : @@ unhandled exception. Body: ÐÏà¡±á&gt;þÿ !#þÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿì¥Áð¿ddddSxSx
  Æ&amp;Ð @à°P ðÀ!
  i4@ñÿ4NormalCJOJPJQJmH  &lt;A@òÿ¡&lt;Default Paragraph Font
  ÿÿÿÿÿÿÿÿ
  GTimes New Roman5Symbol3Arial;Helvetica ðÐhÚKl&amp;ÚKl&amp; ð¥À´´0&quot;ðþÿ
  àòùOh«+'³Ù0éýþÿ
  ÕÍÕ.+,ù®0éýþÿÿÿ 
  þÿÿÿþÿÿÿþÿÿÿþÿÿÿ&quot;þÿÿÿþÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿRoot Entryÿÿÿÿÿÿÿÿ ÀF$1TableÿÿÿÿÿÿÿÿÿÿÿÿWordDocumentÿÿÿÿÿÿÿÿSummaryInformation(ÿÿÿÿDocumentSummaryInformation8ÿÿÿÿÿÿÿÿÿÿÿÿ, stacktrace: com.fasterxml.jackson.core.JsonParseException: Invalid UTF-8 middle byte 0x11
   at [Source: (org.apache.camel.converter.stream.ByteArrayInputStreamCache); line: 1, column: 4]
      at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1840)
      at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:712)
      at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidOther(UTF8StreamJsonParser.java:3573)
      at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._decodeCharForError(UTF8StreamJsonParser.java:3318)
      at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidToken(UTF8StreamJsonParser.java:3544)
      at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._handleUnexpectedValue(UTF8StreamJsonParser.java:2651)
      at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._nextTokenNotInObject(UTF8StreamJsonParser.java:856)
      at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:753)
      at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:4340)
      at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4189)
      at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3242)
      at org.apache.camel.component.jackson.JacksonDataFormat.unmarshal(JacksonDataFormat.java:188)
      at org.apache.camel.support.processor.UnmarshalProcessor.process(UnmarshalProcessor.java:64)
      at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.doRun(RedeliveryErrorHandler.java:702)
      at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.run(RedeliveryErrorHandler.java:616)
      at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:148)
      at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:60)
      at org.apache.camel.processor.Pipeline.process(Pipeline.java:147)
      at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:286)
      at org.apache.camel.impl.engine.DefaultAsyncProcessorAwaitManager.process(DefaultAsyncProcessorAwaitManager.java:83)
      at org.apache.camel.support.AsyncProcessorSupport.process(AsyncProcessorSupport.java:40)
      at org.apache.camel.component.undertow.UndertowConsumer.handleRequest(UndertowConsumer.java:230)
      at io.undertow.server.Connectors.executeRootHandler(Connectors.java:376)
      at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      at java.base/java.lang.Thread.run(Thread.java:834)
  
  </code></pre>
  <p>Why is something as simple as consuming a file so complicated in camel? Please help!</p>