Transferring binary documents in web services – MTOM

I am currently grappling with the challenge of transferring large binary documents in Web Services in an efficient manner. Finally, some of my colleagues came up with the suggestion to use MTOM, which seems to be very promising.

From my initial understanding of the protocol, I would think that MTOM has the  following advantages compared with the approach of including large documents base64 encoded or hex encoded within the SOAP envelope itself:

  • Smaller messages – less bandwith intensive communication
  • No base64 or hex encoding and decoding needed – less CPU resources needed
  • Easier XML parsing since the large document is not included in the XML document (probably both less CPU intensive and memory intensive, depending on the parser)

I would expect that the removal of base64 (or hex) encoding and decoding, together with potentially much swifter XML parsing would significantly lower latency at intermediaries in the value chain. My problem now, is that this is only a gut feeling, rather than hard facts. So, I am preparing to set up a test of MTOM in this respect, with different document sizes to try to measure the differences.

Further reading:

To be continued…