Search code examples
apachespring-bootcxfjax-wsmtom

Spring Boot, Apache CXF 3.2.5 with MTOM sends empty attachment


I'm having a weird issue with Apache CXF and large (375MB) MTOM attachments are empty. Running it locally in Eclipse produces the desired results, but deploying it to our server just gives an empty attachment.

The server is written in .NET and doesn't support chunking. With Chunking enabled the client works, but when i disable cunking it fails.

Sadly i'm unable to debug on the server, so i'm restricted to trace logging.

I've tried every trick i've been able to google.

  • Disable schema validation (CXF-4551) (CXF-7758)
  • Manually copying the file to java.io.tmpdir before sending, to ensure it can be read.
  • Custom DataSource
  • Disable WS-Security
  • Disable logging interceptor

Nothing seems to make a difference. Every run i just get something like the following

</soap:Body></soap:Envelope>
--uuid:40ef745b-ac3c-4013-bbe7-a9cc28880423
Content-Type: application/xml
Content-Transfer-Encoding: binary
Content-ID: <[email protected]>
Content-Disposition: attachment;name="32_2018-03-28_output.xml"
--uuid:40ef745b-ac3c-4013-bbe7-a9cc28880423

Trying with a smaller (2KB) file on the server works just fine. A 75MB file gets attached correctly, but results in a HTTP 400 from the receiver (which i suspect is because the file is not fully transferred)

Does anyone have any ideas as to what might be causing this ?


Solution

  • After much trial & error, i finally managed to "solve" this. I enabled schema validation, and the data now appears. This is the exact issue that both bugs in my original question claims to fix.

        Client client = ClientProxy.getClient(port);
        BindingProvider bp = ((BindingProvider) port);
        bp.getRequestContext().put("schema-validation-enabled", "true");