Also, the encoding/decoding process slows down the application performance.This approach is also often referred as “by value” or “inline attachment” method. It becomes very inefficient when transferring a large amount of binary data because the base64 text encoding technique bloats the data by a factor of 1.33x (UTF-8 text encoding) or 2.66x (UTF-16 text encoding) of the original size. This approach is the simplest way and is only suitable for transferring a small amount of binary data. The following picture depicts this process: Upon receiving the SOAP message, the receiver decodes the encoded String in order to re-construct the original binary data. In other words, the raw binary data is converted to an encoded String which is value of an XML element in the SOAP message. In the approach employed by this article, the binary data is embedded directly in the SOAP envelop using base64 text encoding. Understand how to transfer binary data via web services The web services library to be used is JAX-WS ( Java API for XML Web Services) which is a built-in technology in Java EE family and is also available in Java SE 6 or later.
content of an arbitrary file) using base64 encoding/decoding approach. In this tutorial, we are going to provide an example of a web services-based application that transfers binary data (e.g.