• 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Consuming binary data from webservice.

Ranch Hand
Posts: 101
Spring Flex Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

javax.xml.stream.XMLStreamException: An invalid XML character (Unicode: 0x2d) was found in the prolog of the document.
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:252

The response I get is in the below format

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

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><StreamFileContentsResponse xmlns="http://activitylogsetup.webservice.time.hrii.adp.com/"><StreamFileContentsResult>AAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBQKAAAAAAChQLg+wfWRfSAAAAAgAAAAKAAAAFFFFFFFFFFFFFFFFFS5DSEdMb2cgc3RhcnRlSSSSSSSSSSDDDDDDDDDDDDDDDDDFFFFFFFFFFFFFFFFFFFFFFFFF</StreamFileContentsResult></StreamFileContentsResponse></s:Body></s:Envelope>

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.
Author and all-around good cowpoke
Posts: 13078
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 claim this furniture in the name of The Ottoman Empire! You can keep this tiny ad:
a bit of art, as a gift, that will fit in a stocking
    Bookmark Topic Watch Topic
  • New Topic