When coding Apache CXF web services, I ran into a problem where the InputStream returned by a DataHandler was empty.
In my CXF web service, I defined a JAXB request message with a member 'sourceData' that is an MTOM attachment.
private DataHandler sourceData;
In the service code -- annotated with @MTOM -- I retrieve this data member and call the writeTo() method of DataHandler to save they bytes on the file system for later processing. Initially, I was producing empty files despite verifying my service code and client SOAPUI settings ("Enable MTOM" on the request).
I found this bug report: https://issues.apache.org/jira/browse/CXF-4551. I'm running CXF 2.7.2, but I tried slipping the following configuration into the endpoint definition my applicationContext.xml (Spring beans).
<entry key="schema-validation-enabled" value="true" />
I was able to read the bytes. Setting the above value to 'false' continued to give me the empty content problem. The bug report said something like this was fixed in 2.7.1, but it still may be an issue.