You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Camille Nazi (JIRA)" <ji...@apache.org> on 2006/11/07 16:58:51 UTC

[jira] Created: (AXIS2-1640) Axis2: Loosing Bytes with MTOM

 Axis2: Loosing Bytes with MTOM
-------------------------------

                 Key: AXIS2-1640
                 URL: http://issues.apache.org/jira/browse/AXIS2-1640
             Project: Apache Axis 2.0 (Axis2)
          Issue Type: Bug
    Affects Versions: 1.0
         Environment: Windows XP, jdk 1.5, jboss-4.0.3SP1, axis2 WAR deployed under jboss.
            Reporter: Camille Nazi


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 losing bytes (checked this via chsum command).  This does not happen on all File extensions, I noticed it so far on zip, jar and xls extensions.

 

Has anyone run into a similar issue, and how did you resolve it?

 

Your help is greatly appreciated !!!

 

Here's the code I am using:

 

 

Here's my Service code:

 

import java.io.File;

import java.util.Iterator;

 

import javax.activation.DataHandler;

import javax.activation.FileDataSource;

 

import org.apache.axiom.om.OMAbstractFactory;

import org.apache.axiom.om.OMElement;

import org.apache.axiom.om.OMFactory;

import org.apache.axiom.om.OMNamespace;

import org.apache.axiom.om.OMText;

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) _iterator.next();

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

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

                        _fileNameEle = _ele;

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

                  }

            }

 

            if (_fileNameEle == null ) {

                  throw new AxisFault("Either Image or FileName is null");

            }

 

            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);

            fileOME.addChild(textData);

 

            OMElement fileOMEName = fac.createOMElement("fileName", omNs);

            if (fileName != null) {

                  fileOMEName.setText(fileName);

            }

            data.addChild(fileOMEName);

            data.addChild(fileOME);

            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) _iterator.next();

            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) binaryNode.getDataHandler();

//        File file = new File(desiredFileName);

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

        OutputStream os = new FileOutputStream(desiredFileName);

        actualDH.writeTo(os);

        os.close();

   }

 

 

Thanks in advance,

Camille



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-1640) Axis2: Loosing Bytes with MTOM

Posted by "Davanum Srinivas (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-1640?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Davanum Srinivas updated AXIS2-1640:
------------------------------------

    Assignee: Thilina Gunarathne

>  Axis2: Loosing Bytes with MTOM
> -------------------------------
>
>                 Key: AXIS2-1640
>                 URL: https://issues.apache.org/jira/browse/AXIS2-1640
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>    Affects Versions: 1.0
>         Environment: Windows XP, jdk 1.5, jboss-4.0.3SP1, axis2 WAR deployed under jboss.
>            Reporter: Camille Nazi
>         Assigned To: Thilina Gunarathne
>         Attachments: apache-ant-1.6.5-bin.zip, MTOMProtoClientModel.java
>
>
> 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 losing bytes (checked this via chsum command).  This does not happen on all File extensions, I noticed it so far on zip, jar and xls extensions.
>  
> Has anyone run into a similar issue, and how did you resolve it?
>  
> Your help is greatly appreciated !!!
>  
> Here's the code I am using:
>  
>  
> Here's my Service code:
>  
> import java.io.File;
> import java.util.Iterator;
>  
> import javax.activation.DataHandler;
> import javax.activation.FileDataSource;
>  
> import org.apache.axiom.om.OMAbstractFactory;
> import org.apache.axiom.om.OMElement;
> import org.apache.axiom.om.OMFactory;
> import org.apache.axiom.om.OMNamespace;
> import org.apache.axiom.om.OMText;
> 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) _iterator.next();
>                   System.out.println("in Method for loop in getFile, OMElement = " + _ele.toString());
>                   if (_ele.getLocalName().equalsIgnoreCase("fileName")) {
>                         _fileNameEle = _ele;
>                         System.out.println(" Found _fileNameEle =  " + _fileNameEle);
>                   }
>             }
>  
>             if (_fileNameEle == null ) {
>                   throw new AxisFault("Either Image or FileName is null");
>             }
>  
>             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);
>             fileOME.addChild(textData);
>  
>             OMElement fileOMEName = fac.createOMElement("fileName", omNs);
>             if (fileName != null) {
>                   fileOMEName.setText(fileName);
>             }
>             data.addChild(fileOMEName);
>             data.addChild(fileOME);
>             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) _iterator.next();
>             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) binaryNode.getDataHandler();
> //        File file = new File(desiredFileName);
>          // desiredFileName is the output filename to save it under.
>         OutputStream os = new FileOutputStream(desiredFileName);
>         actualDH.writeTo(os);
>         os.close();
>    }
>  
>  
> Thanks in advance,
> Camille

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-1640) Axis2: Loosing Bytes with MTOM

Posted by "Thilina Gunarathne (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS2-1640?page=comments#action_12448153 ] 
            
Thilina Gunarathne commented on AXIS2-1640:
-------------------------------------------

Your attachment worked fine for me with your code...
My environment is  Linux+tomcat 5.0.28+jdk 1.4 as well as in jdk 1.5.

Can you please give it a try using Tomcat... Then we can 

>  Axis2: Loosing Bytes with MTOM
> -------------------------------
>
>                 Key: AXIS2-1640
>                 URL: http://issues.apache.org/jira/browse/AXIS2-1640
>             Project: Apache Axis 2.0 (Axis2)
>          Issue Type: Bug
>    Affects Versions: 1.0
>         Environment: Windows XP, jdk 1.5, jboss-4.0.3SP1, axis2 WAR deployed under jboss.
>            Reporter: Camille Nazi
>         Attachments: apache-ant-1.6.5-bin.zip
>
>
> 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 losing bytes (checked this via chsum command).  This does not happen on all File extensions, I noticed it so far on zip, jar and xls extensions.
>  
> Has anyone run into a similar issue, and how did you resolve it?
>  
> Your help is greatly appreciated !!!
>  
> Here's the code I am using:
>  
>  
> Here's my Service code:
>  
> import java.io.File;
> import java.util.Iterator;
>  
> import javax.activation.DataHandler;
> import javax.activation.FileDataSource;
>  
> import org.apache.axiom.om.OMAbstractFactory;
> import org.apache.axiom.om.OMElement;
> import org.apache.axiom.om.OMFactory;
> import org.apache.axiom.om.OMNamespace;
> import org.apache.axiom.om.OMText;
> 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) _iterator.next();
>                   System.out.println("in Method for loop in getFile, OMElement = " + _ele.toString());
>                   if (_ele.getLocalName().equalsIgnoreCase("fileName")) {
>                         _fileNameEle = _ele;
>                         System.out.println(" Found _fileNameEle =  " + _fileNameEle);
>                   }
>             }
>  
>             if (_fileNameEle == null ) {
>                   throw new AxisFault("Either Image or FileName is null");
>             }
>  
>             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);
>             fileOME.addChild(textData);
>  
>             OMElement fileOMEName = fac.createOMElement("fileName", omNs);
>             if (fileName != null) {
>                   fileOMEName.setText(fileName);
>             }
>             data.addChild(fileOMEName);
>             data.addChild(fileOME);
>             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) _iterator.next();
>             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) binaryNode.getDataHandler();
> //        File file = new File(desiredFileName);
>          // desiredFileName is the output filename to save it under.
>         OutputStream os = new FileOutputStream(desiredFileName);
>         actualDH.writeTo(os);
>         os.close();
>    }
>  
>  
> Thanks in advance,
> Camille

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-1640) Axis2: Loosing Bytes with MTOM

Posted by "Deepal Jayasinghe (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-1640?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Deepal Jayasinghe updated AXIS2-1640:
-------------------------------------

    Priority: Blocker  (was: Major)

>  Axis2: Loosing Bytes with MTOM
> -------------------------------
>
>                 Key: AXIS2-1640
>                 URL: https://issues.apache.org/jira/browse/AXIS2-1640
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>    Affects Versions: 1.0
>         Environment: Windows XP, jdk 1.5, jboss-4.0.3SP1, axis2 WAR deployed under jboss.
>            Reporter: Camille Nazi
>            Assignee: Thilina Gunarathne
>            Priority: Blocker
>         Attachments: apache-ant-1.6.5-bin.zip, MTOMProtoClientModel.java
>
>
> 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 losing bytes (checked this via chsum command).  This does not happen on all File extensions, I noticed it so far on zip, jar and xls extensions.
>  
> Has anyone run into a similar issue, and how did you resolve it?
>  
> Your help is greatly appreciated !!!
>  
> Here's the code I am using:
>  
>  
> Here's my Service code:
>  
> import java.io.File;
> import java.util.Iterator;
>  
> import javax.activation.DataHandler;
> import javax.activation.FileDataSource;
>  
> import org.apache.axiom.om.OMAbstractFactory;
> import org.apache.axiom.om.OMElement;
> import org.apache.axiom.om.OMFactory;
> import org.apache.axiom.om.OMNamespace;
> import org.apache.axiom.om.OMText;
> 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) _iterator.next();
>                   System.out.println("in Method for loop in getFile, OMElement = " + _ele.toString());
>                   if (_ele.getLocalName().equalsIgnoreCase("fileName")) {
>                         _fileNameEle = _ele;
>                         System.out.println(" Found _fileNameEle =  " + _fileNameEle);
>                   }
>             }
>  
>             if (_fileNameEle == null ) {
>                   throw new AxisFault("Either Image or FileName is null");
>             }
>  
>             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);
>             fileOME.addChild(textData);
>  
>             OMElement fileOMEName = fac.createOMElement("fileName", omNs);
>             if (fileName != null) {
>                   fileOMEName.setText(fileName);
>             }
>             data.addChild(fileOMEName);
>             data.addChild(fileOME);
>             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) _iterator.next();
>             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) binaryNode.getDataHandler();
> //        File file = new File(desiredFileName);
>          // desiredFileName is the output filename to save it under.
>         OutputStream os = new FileOutputStream(desiredFileName);
>         actualDH.writeTo(os);
>         os.close();
>    }
>  
>  
> Thanks in advance,
> Camille

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-1640) Axis2: Loosing Bytes with MTOM

Posted by "Camille Nazi (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS2-1640?page=comments#action_12448510 ] 
            
Camille Nazi commented on AXIS2-1640:
-------------------------------------

Did you check the byte size and did they match?  Were you able to open the Zip file in Winzip?

I downloaded Tomcat 5.0.28 and I am using jdk 1.5.   I deployed the axis WAR file in Tomcat and I still ran into the same issue.  
On the surface it looks like the file transferred OK, but if you do cksum on the 2 files, you'll see that some bytes are missing.

I 

>  Axis2: Loosing Bytes with MTOM
> -------------------------------
>
>                 Key: AXIS2-1640
>                 URL: http://issues.apache.org/jira/browse/AXIS2-1640
>             Project: Apache Axis 2.0 (Axis2)
>          Issue Type: Bug
>    Affects Versions: 1.0
>         Environment: Windows XP, jdk 1.5, jboss-4.0.3SP1, axis2 WAR deployed under jboss.
>            Reporter: Camille Nazi
>         Attachments: apache-ant-1.6.5-bin.zip
>
>
> 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 losing bytes (checked this via chsum command).  This does not happen on all File extensions, I noticed it so far on zip, jar and xls extensions.
>  
> Has anyone run into a similar issue, and how did you resolve it?
>  
> Your help is greatly appreciated !!!
>  
> Here's the code I am using:
>  
>  
> Here's my Service code:
>  
> import java.io.File;
> import java.util.Iterator;
>  
> import javax.activation.DataHandler;
> import javax.activation.FileDataSource;
>  
> import org.apache.axiom.om.OMAbstractFactory;
> import org.apache.axiom.om.OMElement;
> import org.apache.axiom.om.OMFactory;
> import org.apache.axiom.om.OMNamespace;
> import org.apache.axiom.om.OMText;
> 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) _iterator.next();
>                   System.out.println("in Method for loop in getFile, OMElement = " + _ele.toString());
>                   if (_ele.getLocalName().equalsIgnoreCase("fileName")) {
>                         _fileNameEle = _ele;
>                         System.out.println(" Found _fileNameEle =  " + _fileNameEle);
>                   }
>             }
>  
>             if (_fileNameEle == null ) {
>                   throw new AxisFault("Either Image or FileName is null");
>             }
>  
>             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);
>             fileOME.addChild(textData);
>  
>             OMElement fileOMEName = fac.createOMElement("fileName", omNs);
>             if (fileName != null) {
>                   fileOMEName.setText(fileName);
>             }
>             data.addChild(fileOMEName);
>             data.addChild(fileOME);
>             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) _iterator.next();
>             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) binaryNode.getDataHandler();
> //        File file = new File(desiredFileName);
>          // desiredFileName is the output filename to save it under.
>         OutputStream os = new FileOutputStream(desiredFileName);
>         actualDH.writeTo(os);
>         os.close();
>    }
>  
>  
> Thanks in advance,
> Camille

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-1640) Axis2: Loosing Bytes with MTOM

Posted by "Camille Nazi (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS2-1640?page=all ]

Camille Nazi updated AXIS2-1640:
--------------------------------

    Attachment: apache-ant-1.6.5-bin.zip

Attached is an ant zip file larger than 3.5 Meg

>  Axis2: Loosing Bytes with MTOM
> -------------------------------
>
>                 Key: AXIS2-1640
>                 URL: http://issues.apache.org/jira/browse/AXIS2-1640
>             Project: Apache Axis 2.0 (Axis2)
>          Issue Type: Bug
>    Affects Versions: 1.0
>         Environment: Windows XP, jdk 1.5, jboss-4.0.3SP1, axis2 WAR deployed under jboss.
>            Reporter: Camille Nazi
>         Attachments: apache-ant-1.6.5-bin.zip
>
>
> 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 losing bytes (checked this via chsum command).  This does not happen on all File extensions, I noticed it so far on zip, jar and xls extensions.
>  
> Has anyone run into a similar issue, and how did you resolve it?
>  
> Your help is greatly appreciated !!!
>  
> Here's the code I am using:
>  
>  
> Here's my Service code:
>  
> import java.io.File;
> import java.util.Iterator;
>  
> import javax.activation.DataHandler;
> import javax.activation.FileDataSource;
>  
> import org.apache.axiom.om.OMAbstractFactory;
> import org.apache.axiom.om.OMElement;
> import org.apache.axiom.om.OMFactory;
> import org.apache.axiom.om.OMNamespace;
> import org.apache.axiom.om.OMText;
> 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) _iterator.next();
>                   System.out.println("in Method for loop in getFile, OMElement = " + _ele.toString());
>                   if (_ele.getLocalName().equalsIgnoreCase("fileName")) {
>                         _fileNameEle = _ele;
>                         System.out.println(" Found _fileNameEle =  " + _fileNameEle);
>                   }
>             }
>  
>             if (_fileNameEle == null ) {
>                   throw new AxisFault("Either Image or FileName is null");
>             }
>  
>             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);
>             fileOME.addChild(textData);
>  
>             OMElement fileOMEName = fac.createOMElement("fileName", omNs);
>             if (fileName != null) {
>                   fileOMEName.setText(fileName);
>             }
>             data.addChild(fileOMEName);
>             data.addChild(fileOME);
>             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) _iterator.next();
>             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) binaryNode.getDataHandler();
> //        File file = new File(desiredFileName);
>          // desiredFileName is the output filename to save it under.
>         OutputStream os = new FileOutputStream(desiredFileName);
>         actualDH.writeTo(os);
>         os.close();
>    }
>  
>  
> Thanks in advance,
> Camille

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-1640) Axis2: Loosing Bytes with MTOM

Posted by "Camille Nazi (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS2-1640?page=all ]

Camille Nazi updated AXIS2-1640:
--------------------------------

    Attachment: MTOMProtoClientModel.java

>  Axis2: Loosing Bytes with MTOM
> -------------------------------
>
>                 Key: AXIS2-1640
>                 URL: http://issues.apache.org/jira/browse/AXIS2-1640
>             Project: Apache Axis 2.0 (Axis2)
>          Issue Type: Bug
>    Affects Versions: 1.0
>         Environment: Windows XP, jdk 1.5, jboss-4.0.3SP1, axis2 WAR deployed under jboss.
>            Reporter: Camille Nazi
>         Attachments: apache-ant-1.6.5-bin.zip, MTOMProtoClientModel.java
>
>
> 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 losing bytes (checked this via chsum command).  This does not happen on all File extensions, I noticed it so far on zip, jar and xls extensions.
>  
> Has anyone run into a similar issue, and how did you resolve it?
>  
> Your help is greatly appreciated !!!
>  
> Here's the code I am using:
>  
>  
> Here's my Service code:
>  
> import java.io.File;
> import java.util.Iterator;
>  
> import javax.activation.DataHandler;
> import javax.activation.FileDataSource;
>  
> import org.apache.axiom.om.OMAbstractFactory;
> import org.apache.axiom.om.OMElement;
> import org.apache.axiom.om.OMFactory;
> import org.apache.axiom.om.OMNamespace;
> import org.apache.axiom.om.OMText;
> 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) _iterator.next();
>                   System.out.println("in Method for loop in getFile, OMElement = " + _ele.toString());
>                   if (_ele.getLocalName().equalsIgnoreCase("fileName")) {
>                         _fileNameEle = _ele;
>                         System.out.println(" Found _fileNameEle =  " + _fileNameEle);
>                   }
>             }
>  
>             if (_fileNameEle == null ) {
>                   throw new AxisFault("Either Image or FileName is null");
>             }
>  
>             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);
>             fileOME.addChild(textData);
>  
>             OMElement fileOMEName = fac.createOMElement("fileName", omNs);
>             if (fileName != null) {
>                   fileOMEName.setText(fileName);
>             }
>             data.addChild(fileOMEName);
>             data.addChild(fileOME);
>             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) _iterator.next();
>             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) binaryNode.getDataHandler();
> //        File file = new File(desiredFileName);
>          // desiredFileName is the output filename to save it under.
>         OutputStream os = new FileOutputStream(desiredFileName);
>         actualDH.writeTo(os);
>         os.close();
>    }
>  
>  
> Thanks in advance,
> Camille

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Resolved: (AXIS2-1640) Axis2: Loosing Bytes with MTOM

Posted by "Thilina Gunarathne (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-1640?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thilina Gunarathne resolved AXIS2-1640.
---------------------------------------

    Resolution: Fixed

This issue was fixed in 1.2 release...

Please reopen if the issue still remains in your environment...

>  Axis2: Loosing Bytes with MTOM
> -------------------------------
>
>                 Key: AXIS2-1640
>                 URL: https://issues.apache.org/jira/browse/AXIS2-1640
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>    Affects Versions: 1.0
>         Environment: Windows XP, jdk 1.5, jboss-4.0.3SP1, axis2 WAR deployed under jboss.
>            Reporter: Camille Nazi
>            Assignee: Thilina Gunarathne
>            Priority: Blocker
>         Attachments: apache-ant-1.6.5-bin.zip, MTOMProtoClientModel.java
>
>
> 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 losing bytes (checked this via chsum command).  This does not happen on all File extensions, I noticed it so far on zip, jar and xls extensions.
>  
> Has anyone run into a similar issue, and how did you resolve it?
>  
> Your help is greatly appreciated !!!
>  
> Here's the code I am using:
>  
>  
> Here's my Service code:
>  
> import java.io.File;
> import java.util.Iterator;
>  
> import javax.activation.DataHandler;
> import javax.activation.FileDataSource;
>  
> import org.apache.axiom.om.OMAbstractFactory;
> import org.apache.axiom.om.OMElement;
> import org.apache.axiom.om.OMFactory;
> import org.apache.axiom.om.OMNamespace;
> import org.apache.axiom.om.OMText;
> 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) _iterator.next();
>                   System.out.println("in Method for loop in getFile, OMElement = " + _ele.toString());
>                   if (_ele.getLocalName().equalsIgnoreCase("fileName")) {
>                         _fileNameEle = _ele;
>                         System.out.println(" Found _fileNameEle =  " + _fileNameEle);
>                   }
>             }
>  
>             if (_fileNameEle == null ) {
>                   throw new AxisFault("Either Image or FileName is null");
>             }
>  
>             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);
>             fileOME.addChild(textData);
>  
>             OMElement fileOMEName = fac.createOMElement("fileName", omNs);
>             if (fileName != null) {
>                   fileOMEName.setText(fileName);
>             }
>             data.addChild(fileOMEName);
>             data.addChild(fileOME);
>             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) _iterator.next();
>             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) binaryNode.getDataHandler();
> //        File file = new File(desiredFileName);
>          // desiredFileName is the output filename to save it under.
>         OutputStream os = new FileOutputStream(desiredFileName);
>         actualDH.writeTo(os);
>         os.close();
>    }
>  
>  
> Thanks in advance,
> Camille

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-1640) Axis2: Loosing Bytes with MTOM

Posted by "Camille Nazi (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS2-1640?page=comments#action_12448511 ] 
            
Camille Nazi commented on AXIS2-1640:
-------------------------------------

Here's the code I use in my Integration Test, and I will be attaching the MTOMProtoClientModel class that I am using below, if this will help. Thanks.

    public void testExercisingService() throws java.lang.Exception {
   	MTOMProtoClientModel clientModel = new MTOMProtoClientModel();
    	clientModel.setTargetEPR("http://localhost:8080/axis2/services/MTOMProtoService");            
	OMElement elementReceivedBackFromService = clientModel.sendFile("C:/downloads/Ant 1.6.5/apache-ant-1.6.5-bin.zip");
	save(elementReceivedBackFromService, "c:/MTOMTestUT/apache-ant-1.6.5-bin.zip");
    }
    
    
    public void save(OMElement element, String desiredFileName) throws Exception {
        OMElement _fileNameEle = null;
        OMElement _fileElement = null;

        for (Iterator _iterator = element.getChildElements(); _iterator.hasNext();) {
          OMElement _ele = (OMElement) _iterator.next();
          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) binaryNode.getDataHandler();
//      File file = new File(desiredFileName);
       // desiredFileName is the output filename to save it under.
      OutputStream os = new FileOutputStream(desiredFileName);
      actualDH.writeTo(os);
      os.close();
 }


>  Axis2: Loosing Bytes with MTOM
> -------------------------------
>
>                 Key: AXIS2-1640
>                 URL: http://issues.apache.org/jira/browse/AXIS2-1640
>             Project: Apache Axis 2.0 (Axis2)
>          Issue Type: Bug
>    Affects Versions: 1.0
>         Environment: Windows XP, jdk 1.5, jboss-4.0.3SP1, axis2 WAR deployed under jboss.
>            Reporter: Camille Nazi
>         Attachments: apache-ant-1.6.5-bin.zip
>
>
> 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 losing bytes (checked this via chsum command).  This does not happen on all File extensions, I noticed it so far on zip, jar and xls extensions.
>  
> Has anyone run into a similar issue, and how did you resolve it?
>  
> Your help is greatly appreciated !!!
>  
> Here's the code I am using:
>  
>  
> Here's my Service code:
>  
> import java.io.File;
> import java.util.Iterator;
>  
> import javax.activation.DataHandler;
> import javax.activation.FileDataSource;
>  
> import org.apache.axiom.om.OMAbstractFactory;
> import org.apache.axiom.om.OMElement;
> import org.apache.axiom.om.OMFactory;
> import org.apache.axiom.om.OMNamespace;
> import org.apache.axiom.om.OMText;
> 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) _iterator.next();
>                   System.out.println("in Method for loop in getFile, OMElement = " + _ele.toString());
>                   if (_ele.getLocalName().equalsIgnoreCase("fileName")) {
>                         _fileNameEle = _ele;
>                         System.out.println(" Found _fileNameEle =  " + _fileNameEle);
>                   }
>             }
>  
>             if (_fileNameEle == null ) {
>                   throw new AxisFault("Either Image or FileName is null");
>             }
>  
>             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);
>             fileOME.addChild(textData);
>  
>             OMElement fileOMEName = fac.createOMElement("fileName", omNs);
>             if (fileName != null) {
>                   fileOMEName.setText(fileName);
>             }
>             data.addChild(fileOMEName);
>             data.addChild(fileOME);
>             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) _iterator.next();
>             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) binaryNode.getDataHandler();
> //        File file = new File(desiredFileName);
>          // desiredFileName is the output filename to save it under.
>         OutputStream os = new FileOutputStream(desiredFileName);
>         actualDH.writeTo(os);
>         os.close();
>    }
>  
>  
> Thanks in advance,
> Camille

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org