Spring Boot, Apache CXF 3.2.5 with MTOM sends empty attachment

十年热恋 提交于 2019-12-11 17:41:14

问题


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: <7611ca0a-22f8-4637-b4f7-a5dfe7f20b81-3@www.somewhere.dk>
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 ?


回答1:


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");



回答2:


I can't add a comment so I'm posting this as an answer.

Jimmy could you perhaps comment on the latest CXF issue and provide some more details? Which version of CXF, what kind of client you are using, real code samples ideally, client logs?



来源:https://stackoverflow.com/questions/51216192/spring-boot-apache-cxf-3-2-5-with-mtom-sends-empty-attachment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!