Core Java, Frameworks & Servers
Friday, 12. May 2017., 15:40
There is often a need to send different files over web service: images, documents or any other binary files. Most common approach is to encode file in base64 string and put that string inside SOAP envelope, with other XML data. This is not ideal because base64 adds some overhead which is not small and it requires entire request to be held in memory while processing, which can be a problem with large files. Another way to send files is to use SOAP Attachments, which is kind of like sending attachments in email. This is better than sending base64 string, but attachment is separated from XML request data and that could be a problem for request processing. MTOM to the rescue! Find out what MTOM is, how it solves problems that base64 encoded strings and attachments have, and how to stream data using it.