Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MTOM and encoded binary data

 
Himai Minh
Ranch Hand
Posts: 1328
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On MZ's notes, p. 103, it says "If you want to use MTOM, you should encode your binary data as xs:base64Binary content".
But from Martin Kalin's Web Service Up and Running, p. 118, it says "MTOM optimizes the transmission by avoiding data bloat, but the message receiver is forced to deal with raw bytes."
According to Martin Kalin, when MTOM is enabled, the binary data sent to the receiver is not encoded in base64. But in MZ's notes, the binary data should be encoded.

Are the quoted statements contradicting with each other?


 
David Lizarraga
Greenhorn
Posts: 5
2
Eclipse IDE Java Ubuntu
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone, I am new to the forum although I have been lurking for quite some time now.

First, let me explain in a few words, what's the process that occurs when we are sending an attachment with MTOM.

If you want an attachment to be sent using MTOM, first of all this attachment should be encoded in Base64.
Then before the soap message is sent, MTOM will optimize the message by deciding (based mostly on the data size) if he should convert the data to a MIME attachment or leave it as Base64 encoded data.
If he decides that it is better to send it as a MIME attachment, then an xop element will be placed where the base64Binary element was, pointing to the location of the MIME attachment, which is outside the soap message (but inside the request/response http message).
This MIME attachment will be raw bytes, not Base64 encoded data anymore.

So both of the statements are true:
1. "If you want to use MTOM, you should encode your binary data as xs:base64Binary content". Yes, at first your data will always be encoded as Base64.
2. "MTOM optimizes the transmission by avoiding data bloat, but the message receiver is forced to deal with raw bytes." True but not always. The client will receive raw bytes whenever MTOM decided to send the data as a MIME attachment, and will receive base64Binary content when he decides not to.

Hope it helped.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2447
96
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi David!

Welcome to CodeRanch and thank you for the nice explanation!

Regards,
Frits
 
David Lizarraga
Greenhorn
Posts: 5
2
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frits Walraven wrote:Hi David!

Welcome to CodeRanch and thank you for the nice explanation!

Regards,
Frits


Thank you Frits
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic