axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nazi, Camille" <>
Subject Axis2 MTOM - File size limit
Date Thu, 02 Nov 2006 23:32:46 GMT
Hi all,

I am using MTOM with Axis2.   I took the MTOM sample bundled with Axis2
and switched it around to where the client sends in the name of the file
to retrieve and the Service returns the file back to the Client and then
the client saves the file to disk (All this is done on my desktop in
windows XP).   I am running axis2 WAR under JBOSS-4.03SP1.


The problem I am running into is that for Zip files larger in size than
3.4 Meg, I am not able to open the Zip files with Winzip and I get an

Start of central directory not found; Zip file corrupt.  Possible cause:
file transfer error.



P.S.:   The file size returned is always exact size as the original file
(looking at it via File Explorer).  It works very well for files less
than 3.4 Meg (Zip files or any other files).

I ran this code against a 5 Meg word file and I was able to open it
fine, so it might be only an issue with zip files.



Is there a size limit somewhere that I need to change?   Anyone knows
why I might be running into this issue?  Is there anything I am missing
or have incorrect in my Save routine on the client side ?  

I need this tool to be able to return large files from the service,
which sizewise it appears to be returning them correctly, but file is


Here's my Service code:



import java.util.Iterator;


import javax.activation.DataHandler;

import javax.activation.FileDataSource;







import org.apache.axis2.AxisFault;


public class MTOMProtoService {



      public OMElement getFile(OMElement element) throws Exception {

            OMElement _fileNameEle = null;

            OMElement _imageElement = null;

            File inputFile = null;


            System.out.println("in Method getFile, OMElement received =
" + element.toString());



            for (Iterator _iterator = element.getChildElements();
_iterator.hasNext();) {

                  OMElement _ele = (OMElement);

                  System.out.println("in Method for loop in getFile,
OMElement = " + _ele.toString());

                  if (_ele.getLocalName().equalsIgnoreCase("fileName"))

                        _fileNameEle = _ele;

                        System.out.println(" Found _fileNameEle =  " +




            if (_fileNameEle == null ) {

                  throw new AxisFault("Either Image or FileName is



            String fileName = _fileNameEle.getText();

            OMFactory fac = OMAbstractFactory.getOMFactory();

            OMNamespace omNs =
fac.createOMNamespace("http://localhost/my", "my");


            OMElement data = fac.createOMElement("getFile", omNs);

            OMElement fileOME = fac.createOMElement("file", omNs);

            FileDataSource dataSource = new FileDataSource(fileName);

            DataHandler expectedDH = new DataHandler(dataSource);

            OMText textData = fac.createOMText(expectedDH, true);



            OMElement fileOMEName = fac.createOMElement("fileName",

            if (fileName != null) {





            return data;





Save in Client Code:


    public void save(OMElement element) throws Exception {

          OMElement _fileNameEle = null;

          OMElement _fileElement = null;

          for (Iterator _iterator = element.getChildElements();
_iterator.hasNext();) {

            OMElement _ele = (OMElement);

            if (_ele.getLocalName().equalsIgnoreCase("fileName")) {

                  _fileNameEle = _ele;


            if (_ele.getLocalName().equalsIgnoreCase("file")) {

                  _fileElement = _ele;




        OMText binaryNode = (OMText) _fileElement.getFirstOMChild();

        //Extracting the data and saving

        DataHandler     actualDH = (DataHandler)

//        File file = new File(desiredFileName);

         // desiredFileName is the output filename to save it under.

        OutputStream os = new FileOutputStream(desiredFileName);






Thanks in advance,


View raw message