Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
282 views
in Technique[技术] by (71.8m points)

w3c - How does MTOM work?

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...