On MZ's notes, p. 103, it says "If you want to use MTOM, you should encode your binary data as xs:base64Binary content".
But from Martin Kalin's Web Service Up and Running, p. 118, it says "MTOM optimizes the transmission by avoiding data bloat, but the message receiver is forced to deal with raw bytes."
According to Martin Kalin, when MTOM is enabled, the binary data sent to the receiver is not encoded in base64. But in MZ's notes, the binary data should be encoded.
Are the quoted statements contradicting with each other?
Hi everyone, I am new to the forum although I have been lurking for quite some time now.
First, let me explain in a few words, what's the process that occurs when we are sending an attachment with MTOM.
If you want an attachment to be sent using MTOM, first of all this attachment should be encoded in Base64.
Then before the soap message is sent, MTOM will optimize the message by deciding (based mostly on the data size) if he should convert the data to a MIME attachment or leave it as Base64 encoded data.
If he decides that it is better to send it as a MIME attachment, then an xop element will be placed where the base64Binary element was, pointing to the location of the MIME attachment, which is outside the soap message (but inside the request/response http message).
This MIME attachment will be raw bytes, not Base64 encoded data anymore.
So both of the statements are true:
1. "If you want to use MTOM, you should encode your binary data as xs:base64Binary content". Yes, at first your data will always be encoded as Base64.
2. "MTOM optimizes the transmission by avoiding data bloat, but the message receiver is forced to deal with raw bytes." True but not always. The client will receive raw bytes whenever MTOM decided to send the data as a MIME attachment, and will receive base64Binary content when he decides not to.