Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 4616 invoked from network); 31 Jan 2007 14:50:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 31 Jan 2007 14:50:53 -0000 Received: (qmail 49291 invoked by uid 500); 31 Jan 2007 14:50:37 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 49172 invoked by uid 500); 31 Jan 2007 14:50:36 -0000 Mailing-List: contact axis-dev-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-dev@ws.apache.org Received: (qmail 49093 invoked by uid 99); 31 Jan 2007 14:50:36 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Jan 2007 06:50:36 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Jan 2007 06:50:27 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 9878B71430D for ; Wed, 31 Jan 2007 06:50:06 -0800 (PST) Message-ID: <16626734.1170255006621.JavaMail.jira@brutus> Date: Wed, 31 Jan 2007 06:50:06 -0800 (PST) From: "Davanum Srinivas (JIRA)" To: axis-dev@ws.apache.org Subject: [jira] Updated: (AXIS2-1640) Axis2: Loosing Bytes with MTOM In-Reply-To: <6346295.1162915131772.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on 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