This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Services and the fly likes Consuming binary data from webservice. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Consuming binary data from webservice." Watch "Consuming binary data from webservice." New topic

Consuming binary data from webservice.

Shasi Mitra
Ranch Hand

Joined: Nov 27, 2008
Posts: 101

Hi all, our web service is produced at .net side and consumed at java side. We are expecting binary data from the web service. I am getting response but while parsing I get the following exception. An invalid XML character (Unicode: 0x2d) was found in the prolog of the document.

The response I get is in the below format

Content-ID: <>
Content-Transfer-Encoding: 8bit
Content-Type: application/xop+xml;charset=utf-8;type="text/xml"


As per the wsdl I should receive the response in byte[] format but parsing fails. To fix this I do not know whether the response is not using proper encoding or the WS adapter has a limitation when binary data is passed by value within the body of the document. Let me know if you can give any inputs on this.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12761
You can't send binary data as part of a SOAP envelope because a SOAP envelope must be legal XML and there are plenty of byte values that are not legal XML.

Usually, binary data gets encoded into legal characters for transmission if it is being sent inside the envelope.

Bulky binary data gets sent as attachments - the --uuid etc text after the closing tag looks like you should be expecting a binary attachment.


I agree. Here's the link:
subject: Consuming binary data from webservice.
Similar Threads
Why Getting Fault Code in SOAP Response Message
JAX-WS MTOM is not workink as expected.
Web Services/SOAP Newbie question
Invoking web service from pl sql, requires a nonce, but I cannot find much info on how to do it
SOAP with Attachment. and WSDL