Hi Daniel, Thanks for that. I was going to low-level I think, I was trying to read in the bytes from the inputstream and write them out to an outputstream.
I now use the DataHandler.writeTo() method and that solved the issue I had. Thanks very much, Jon. -----Original Message----- From: Daniel Kulp [mailto:[email protected]] Sent: 11 July 2011 17:38 To: [email protected] Cc: Jon Morgan Subject: Re: DataHandler InputStream 0 Bytes Using MTOM The available() method will not return the size of the data. You would actually need to read(...) until the end of the stream is hit to determine the length. Note from the javadoc for available() method: <p> Note that while some implementations of {@code InputStream} will return * the total number of bytes in the stream, many will not. It is * never correct to use the return value of this method to allocate * a buffer intended to hold all data in this stream. Dan On Monday, July 11, 2011 7:55:08 AM jmorgan74 wrote: > Bit more info: > > Here's my Web Service Interface: > > /@WebService > public interface HelloWorld { > String sayHi(String text, > @XmlMimeType("application/octet-stream") > DataHandler dataHandler); > }/ > > Here's the implementation: > > /public String sayHi(String text, > DataHandler dataHandler) { > > InputStream is; > > try { > is = dataHandler.getInputStream(); > > LOG.info("BYTES: " + is.available()); > > } catch (IOException e) { > > e.printStackTrace(); > } > > return "Hello " + text; > } > } > / > > Cheers, > > Jon. > > > > -- > View this message in context: > http://cxf.547215.n5.nabble.com/DataHandler-InputStream-0-Bytes-Using-MTOM- > tp4575283p4575311.html Sent from the cxf-user mailing list archive at > Nabble.com. -- Daniel Kulp [email protected] http://dankulp.com/blog Talend - http://www.talend.com
