MTOM combines the composability of Base 64 encoding with the transport efficiency of SOAP with Attachments. Non-XML data is processed just as it is with SOAP with Attachments SWA – the data is simply streamed as binary data in one of the MIME message parts. (The MTOM processing model is described in greater detail below.)
MTOM is composed of three distinct specifications:
During deserialization the processing layers that access the attachment would do so through the base-64-encoding layer (again, this is a temporary representation that occurs just before serialization).
(Please accept my apologies for the formatting issues - Community Server keeps adding multiple line breaks and I'm tired of fighting it...) <soap:Envelope xmlns:soap='http://www.w3.org/2002/12/soap-envelope' xmlns:rep='http://www.w3.org/2004/08/representation' xmlns:xmlmime='http://www.w3.org/2004/06/xmlmime'> <soap:Header> <rep:Representation resource='http://example.org/myPackage.zip'> <rep:Data xmlmime:contentType='application/zip'> /aWKKapGGyQ= </rep:Data> </rep:Representation> </soap:Header> <soap:Body> <x:MyData xmlns:x='http://example.org/mystuff'> <x:name>Learning About Web Services</x:name> <x:img src='http://example.org/myPackage.zip'/> </x:MyData> </soap:Body></soap:Envelope>
(Please accept my apologies for the formatting issues - Community Server keeps adding multiple line breaks and I'm tired of fighting it...)
<soap:Envelope xmlns:soap='http://www.w3.org/2002/12/soap-envelope' xmlns:rep='http://www.w3.org/2004/08/representation' xmlns:xmlmime='http://www.w3.org/2004/06/xmlmime'> <soap:Header> <rep:Representation resource='http://example.org/myPackage.zip'> <rep:Data xmlmime:contentType='application/zip'> /aWKKapGGyQ= </rep:Data> </rep:Representation> </soap:Header> <soap:Body> <x:MyData xmlns:x='http://example.org/mystuff'> <x:name>Learning About Web Services</x:name> <x:img src='http://example.org/myPackage.zip'/> </x:MyData> </soap:Body></soap:Envelope>
What About SOAP with Attachments and DIME?Why not simply use SOAP with Attachments (SwA) or DIME (Direct Internet Message Encapsulation)? There are two disadvantages to using SwA:
The DIME specification was created to address performance issues when processing MIME attachments. DIME avoided having to scan the entire message to locate boundaries because the length of the attached files was encoded in the message header, enabling large attachments to be processed in “chunks”. While DIME provided a more efficient processing model it still didn’t provide an infoset model for the message and attachment.
MTOM provides a compromise between the MIME model and the Web services model (an infoset representation is available – see the MTOM processing model above). MTOM messages are valid SWA messages, lowering the cost of supporting MTOM for existing SWA implementations. MTOM attachments are streamed as binary data within a MIME message part, making it fairly easy to pass MTOM attachments to SWA or receive SWA attachments into an MTOM implementation.
Stay tuned for code samples - coming soon!
By Jesus Rodriguez This article is part of a series intended to illustrate WS-* protocols interoperability
A few months ago I wrote a couple of articles ( WCF-ORA , ORA-WCF ) about Message Transmission Optimization
MTOMinteroperabilitybetweenOracleAppServerandSunWSIT
AfewmonthsagoIwroteacoupleofa...