• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to pass binary data in XML?

 
Ranch Hand
Posts: 472
Objective C Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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/
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic