The problem with Spring-WS is that in contrast to SAAJ and Axiom, it doesn’t have a well defined MTOM processing model.
Since Spring-WS has two implementations, one based on SAAJ and another one based on Apache Axiom let’s start by examining how these two libraries handle MTOM.
SAAJ doesn’t perform any kind of XOP decoding (beyond MIME processing): This is the optimal processing model because XOP unaware code will just work (although not necessarily with the best performance) and it is still possible to write code that processes MTOM messages in a highly optimized way (including full streaming support for binary data, introduced in Axiom 1.2.13).
That new API would be easy to implement in the Axiom based implementation because Axiom already provides the necessary APIs for that.
The case is less trivial for SAAJ because that API doesn’t perform any XOP decoding itself.
A solution would be to let the SAAJ based implementation return a In order to support large attachments a Web service stack needs to provide mechanisms to process them without copying them in their entirety into memory.
There are two techniques commonly used for this: None of this is supported by the SAAJ API.