File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes SAAJ for binary data Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Web Services
Reply Bookmark "SAAJ for binary data" Watch "SAAJ for binary data" New topic
Author

SAAJ for binary data

Matt TC
Greenhorn

Joined: Aug 04, 2005
Posts: 5
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

Joined: Aug 13, 2005
Posts: 8
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
 
 
subject: SAAJ for binary data
 
Threads others viewed
Maximum size of attachments?
sending pdf or any attachment from a java webservice to java client using JAX-WS and SAAJ
Email Java object in memory
Strange JBoss error
Attachment problem with jaxm and Squid proxy
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture