Gopalan Suresh Raj
Web Cornucopia
Gopalan's Profile
Archives
« November 2009
SunMonTueWedThuFriSat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
     
       
Today
Click me to subscribe Download Open ESB
Syndication
Search

Table of Contents
Tags
bpel choreography ejb esb http integration javacaps javaee javaone jax-ws jbi management openesb orchestration process-oriented rest sca service-oriented soa soap wsdl xml xsd
Links
 
Referrers

Today's Page Hits: 208

Map of Visitors
Locations of visitors to this page
Caveat Emptor
This is my personal weblog. The contents of this Weblog represent my personal opinion which may differ from the official views of my employer, Sun Microsystems, Inc. or any past employers. I do not speak for my employer or any past employers.
View Gopalan Suresh Raj's profile on LinkedIn
« JBI/SOA Tips: Use... | Main | JBI/SOA Tips: Be... »
Saturday Apr 28, 2007
Apr
28
JBI/SOA Tips: As much as possible, avoid using Base64 Encoded/Raw bytes in the message Body

At times an XML could contain characters or declarations that are not supported by SOAP or the runtime - examples are, DTD declarations, binary data, locale specific character encoding, etc. In such cases you may have to use Base64 encoding of the raw bytes into the message payload. You have to be aware of the fact that base64 encoding will increase the amount of processing required before transmitting an XML document and again before parsing it at the receiving end. This means once a message is encoded, the recipient must decode the entire message in order to work with any part of it. You just have to also be aware of the fact that both parties need to know out of band what the data is for this approach to work. Another disadvantage is Base64 encoding will increase the message size significantly.

Like this write-up? Subscribe to receive  more  like it.


 

Posted at 01:47AM Apr 28, 2007 by Suresh Gopalan in A Tip a Day  |  Listen to this article Listen to this entry  |  Comments added Comments[2]

Comments:

"will increase the amount of processing required before transmitting an XML document and again before parsing it"
Parsing the XML should actually be easier since its dealt with as a single lexical token with no change in parser state.

"both parties need to know out of band what the data is"
And the alternative, MTOM or similar attachment ways do not?

"Base64 encoding will increase the message size significantly"
The overhead of BASE64 is only about +34%, its no more significant that its used constantly by mail/MIME.

While formats, frameworks and specs change constantly, BASE64 simply works. Those are our experiences anyhow.

Posted by Casper on April 28, 2007 at 01:07 PM PDT #

Hello Casper

Everything has its use and a place under the Sun. You only talk about parsing the XML being easier, but fail to consider the fact that there is work involved for <span style="font-weight: bold; font-style: italic;">encoding the message before packaging it</span> at the senders end, and then<span style="font-weight: bold; font-style: italic;"> decoding the message before parsing it</span> at the <span style="font-style: italic;">receivers </span>end. You also fail to consider the that both the sender and the receiver have to <span style="font-weight: bold; font-style: italic;">negotiate the schema out of band to process the XML</span> which means it becomes difficult to for a new consumer to write a client for the service since the service interface is not well-defined. There are also <a href="http://blogs.sun.com/gopalan/entry/jbi_soa_tips_beware_of">SOAP verbosity issues that you need to take into account when you base64 encode the message, which is why my next SOA tip for today (see <a href="http://blogs.sun.com/gopalan/entry/jbi_soa_tips_beware_of">http://blogs.sun.com/gopalan/entry/jbi_soa_tips_beware_of). I would suggest that for large messages you should consider using MTOM.

Cheers
Gopalan.

Posted by Gopalan Suresh Raj on April 29, 2007 at 10:58 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed

Disclaimer: The contents of this Weblog represent my personal opinion which may differ from the official views of my employer, Sun Microsystems, Inc. or any past employers.



View blog top tags

Enter your email address:

Delivered by FeedBurner

[Valid RSS]