You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Patric Fornasier <Pa...@nicta.com.au> on 2006/05/11 06:05:37 UTC

Loosing bytes with MTOM

Hi,

I'm sending a small png image from one server to another via MTOM. The
service and the client are both on the same machine.

The original size of the image is 6450 bytes. When the clients copies
the file to the file system however, the size of this copy is now 15083
bytes!

Funny enough, the received picture looks fine. It's just roughly 3 times
bigger.

Anybody got an idea what's going on here?

Here's the code for the server:
---
Image image = new ImageIO().loadImage(new FileInputStream(file));
DataSource dataSource = new ImageDataSource("image.png", image);
DataHandler dataHandler = new DataHandler(dataSource);
// create an optimized OMText node with the above DataHandler
OMText textData = factory.createOMText(dataHandler, true);
out.addChild(textData);

And for the client:
---
OMText out = (OMText) response.getFirstOMChild();		
DataHandler actualDH = (DataHandler) out.getDataHandler();
ImageIO io = new ImageIO();
Image img = io.loadImage(actualDH.getDataSource().getInputStream());
FileOutputStream imageOutStream = new
FileOutputStream("c:/dynamic-axis.png");
io.saveImage("image/png", img, imageOutStream);

Any hints are greatly appreciated!

Cheers,
patric

--------------------------------------------------------------------------
This email and any attachments may be confidential. They may contain legally
privileged information or copyright material. You should not read, copy,
use or disclose them without authorisation. If you are not an intended
recipient, please contact us at once by return email and then delete both
messages. We do not accept liability in connection with computer virus,
data corruption, delay, interruption, unauthorised access or unauthorised
amendment. This notice should not be removed.