Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to pass binary data in XML?  RSS feed

 
D Rog
Ranch Hand
Posts: 472
Linux Objective C Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used approach of 64 based encoding, however it seems to making bulk requests. I've tried using data<[[..]]> however it seems to sensitive to any angle brackets inside. What's common practice helping to pass binary data without much overhead on encoding/decoding and request size inflation?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since XML can NOT be arbitary bytes, you MUST encode somehow. Base64 is the most efficient method for doing this. The inflation is only 4 characters per 3 bytes, so it is not a big deal unless you have a slow connection or huge files.
One alternative would be to use XML to pass information pointing to a file that can be transferred by FTP or some other protocol designed for binary data.
Bill
 
Keith Baker
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Encoding is one option. Encapsulating the content using MIME-based packaging is another route. Not sure if you are using SOAP or not, but SwA[1] and MTOM/XOP[2] are two options. Attachments Profile 1.0 gives you a fighting chance of interopability with SwA.

[1] http://www.w3.org/TR/SOAP-attachments
[2] http://www.w3.org/TR/xop10/
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!