Hi Devs, In Apache Syanpse, we have a requirement to proxy an MTOM enabled web service with minimum overhead. Large files (even in GB range) should be able to go through Synapse without running it OOM.
To satisfy this requirement, Synapse should be able to forward an incoming SOAP message with MTOM attachments to the backend service without building the attachments. Synapse might read/modify the SOAP envelop but not the attachments. Therefore, it should be possible to stream attachments directly from the Synpase's client to the backend service. However, in the current implementation of AXIOM and Axis2, MTOM attachments are built (in memory or in a file) by SOAPMessageFormatter. This caused Synapse to run OOM when in the above mentioned scenario. I have come up with a fix for this. It is to introduce a new org.apache.axiom.attachments.impl.AbstractPart implementation which streams non-soap MIME parts without building them. To introduce this new feature without breaking existing stuff, I'm planning to introduce a new message context property which enables MTOM streaming. org.apache.axis2.builder.BuilderUtils class will check this property in the message context and create org.apache.axiom.attachments.Attachments object accordingly. Does this sound like the correct way of introducing this feature? Appreciate your feedback. Thanks, -- Sadeep Jayasumana Software Engineer, WSO2 Inc.