Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How much extra overhead is generated when sending a file over a web service as a byte array?

This question and answer shows how to send a file as a byte array through an XML web service. How much overhead is generated by using this method for file transfer? I assume the data looks something like this:

<?xml version="1.0" encoding="UTF-8" ?>
<bytes>
    <byte>16</byte>
    <byte>28</byte>
    <byte>127</byte>
    ...
</bytes>

If this format is correct, the bytes must first be converted to UTF-8 characters. Each of these characters allocates 8 bytes. Are the bytes stored in base 10, hex, or binary characters? How much larger does the file appear as it is being sent due to the XML data and character encoding? Is compression built into web services?

like image 400
Shawn Avatar asked Dec 23 '22 14:12

Shawn


1 Answers

Typically a byte array is sent as a base64 encoded string, not as individual bytes in tags.

http://en.wikipedia.org/wiki/Base64

The base64 encoded version is about 137% of the size of the original content.

like image 64
Kevin Dente Avatar answered Dec 25 '22 04:12

Kevin Dente