Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

SAAJ for binary data  RSS feed

 
Matt TC
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, I tried sending a SOAP message to a http servlet with an attachment consisting of binary data (a byte array of non-printables) but I was unsuccessful.

I attach the data like this:

BinaryDataSource bds = new BinaryDataSource(new ByteArrayInputStream(bytes));
DataHandler dh = new DataHandler(bds);
AttachmentPart attach = soapMsg.createAttachmentPart(dh);
attach.setContentId("data");
soapMsg.addAttachmentPart(attach);

where BinaryDataSource is my own simple implementation of DataSource.
When I send the SOAP message, some data appears to be there (it is non-printable data so I only get a few letters here and there) but once the servlet catches the SOAP message, the data is gone.

Any idea on how to transmit or recover that data?
Other ways of transmitting binary data with SOAP are also welcome although I am using HUGE files so encoding is not an option.
TIA
-matt
 
Harish M
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check the length of byte stream transmitted and recieved at the other end.Is that problem occurs only for the datasource object or for anything sent ?

Harish
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!