Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does MTOM work?

Tags:

w3c

mtom

MTOM is the W3C Message Transmission Optimization Mechanism, a method of efficiently sending binary data to and from web services.

How does it work in general?

like image 564
Brian R. Bondy Avatar asked Oct 18 '08 23:10

Brian R. Bondy


People also ask

How MTOM?

With MTOM, the SOAP messages are sent as MIME messages with the BASE64 encoding being replaced with a placeholder. The binary data is then placed between delimiters (which happens for each piece of binary data), and then placed at the end of the SOAP request. The binary data is then sent unencoded.

Why MTOM is used?

The MTOM message format allows bitstream compression of binary data. Data that would otherwise have to be encoded in the SOAP message is instead transmitted as raw binary data in a separate MIME part.

What is MTOM encoding?

The MTOM sample demonstrates the use of the Message Transmission Optimization Mechanism (MTOM) message encoding with a WSHttpBinding. MTOM is a mechanism for transmitting large binary attachments with SOAP messages as raw bytes, allowing for smaller messages.

What is MTOM attachment?

You can send and receive web service messages which include SOAP Message Transmission Optimization Mechanism (MTOM) attachments. In a MIME multipart SOAP message, the SOAP body is the first part of the message, and the attachment or attachments are in subsequent parts.


1 Answers

It all begins with the fact that SOAP is XML. And when you send anything other than text, for instance, an image - it has to be converted into a datatype that an XML processor can understand.

Without MTOM, your image will be converted to base64Binary and placed smack in the middle of your SOAP envelope. This conversion process makes the data fat.

<tns:data>A very looooooooooooooooooooooong base64Binary string</tns:data>

Here's a simple illustration:

enter image description here

With MTOM, the image will be transmitted outside the envelope as a MIME attachment - in short, it's sent according to its original datatype: a jpg, png, or gif. Of course it's still transmitted as binary data, but this time, there's no XML-related conversion, avoiding the computational overhead. XOP comes into the picture as it's the one that gives the location of the externalized image.

<soap:Envelope>     <soap:Body>         <tns:data>             <xop:include href="SomeUniqueID-ThatLeadsToTheImage"/>         </tns:data>     </soap:Body> </soap:Envelope> 

Content-id: "SomeUniqueID"
Content-Type: image/png

image binary data here

like image 188
Jops Avatar answered Sep 29 '22 06:09

Jops