3.8. Handling Binary Data

A SOAP message is an XML document which, according to the XML specification, must contain only legal characters in the document's character encoding. This means you can't just insert binary data into a SOAP message and ship it over the network. Therefore, sending images, files, and other binary data with SOAP requires special handling.

You can choose between several different methods for handling binary data based on the size of the data and the nature of the application. In this section, I will briefly explain three such methods and when you'd want to use each.

3.8.1. Base64 Encoding

For binary content of relatively small size, you can encode the bits into a legal character representation using any encoding/decoding ...

Get Real World XML Web Services: For VB and VB .NET Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.