Return-Path: Delivered-To: apmail-ws-axis-user-archive@www.apache.org Received: (qmail 82442 invoked from network); 6 Jun 2007 20:01:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Jun 2007 20:01:25 -0000 Received: (qmail 73863 invoked by uid 500); 6 Jun 2007 20:01:20 -0000 Delivered-To: apmail-ws-axis-user-archive@ws.apache.org Received: (qmail 73841 invoked by uid 500); 6 Jun 2007 20:01:19 -0000 Mailing-List: contact axis-user-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-user@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-user@ws.apache.org Received: (qmail 73830 invoked by uid 99); 6 Jun 2007 20:01:19 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Jun 2007 13:01:19 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of Dominik@pich.info designates 83.133.96.10 as permitted sender) Received: from [83.133.96.10] (HELO server2.greatnet.de) (83.133.96.10) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Jun 2007 13:01:15 -0700 Received: from [192.168.178.20] (p50866E22.dip.t-dialin.net [80.134.110.34]) by server2.greatnet.de (Postfix) with ESMTP id 3C8ABB4626D; Wed, 6 Jun 2007 22:00:37 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Dominik Pich Subject: Attachments for Webservice in Eclipse using axis 1.3 on tomcat 5.5 Date: Wed, 6 Jun 2007 22:00:48 +0200 To: axis-user@ws.apache.org X-Mailer: Apple Mail (2.752.3) X-Virus-Checked: Checked by ClamAV on apache.org Hi, I am using Eclipse 3.2 with the latest Webtools to develop a webservice. As engine to run the service I use to tomcat 5.5 with axis 1.3 (axis is coming with eclipse!? - well I havent installed it anyway :D) IDEA: the service exposes two operations: BackupResult uploadFiles(BackupFile[] files); BackupResult downloadFiles(); //result is container for error OR files array. SERVER: Axis was used here to make WSDL for my Java Bean and manages the service when published on the tomcat server. CLIENT: wsdl2java genereated me the necessary stubs for the needed Bean (and all complex types) My calls to the service are performed using axis SO FAR SO GOOD All's up and running... but one major drawback: every file's content is a byte[] This works for small files or few files but not when having to load all data in memory just so I can then send it off. I decided that what I wanted were attachments. And as my clients are java and/or c# I needed a interopable solution. AND HERE'S WHERE IT WENT WRONG :) I realized I'd need REAL Attachments (not just some variable typed as DataHandler) and they'd have to be in the DIME format. I cant get ANY attachment to work though :/ (oh and I do have action and mail.jar - no RuntimeError IIRC) I tackled upload first. So the client has to attach data. //remove old and make DIME try { ((BackupServiceProxy) backupService).getStub().clearAttachments(); ((BackupServiceProxy) backupService).getStub()._setProperty( Call.ATTACHMENT_ENCAPSULATION_FORMAT, Call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME); } catch (Exception e) { e.printStackTrace(); } ... //attach File DataSource source = new FileDataSource(new File(path)); DataHandler buildFile = new DataHandler(source); try { ((BackupServiceProxy) backupService).getStub().addAttachment( buildFile); } catch (Exception e) { e.printStackTrace(); } I do this in a static private method after which I make the call using the proxy object (which in turn just calls the stub): public core.BackupResult uploadFiles(core.BackupSettings settings, core.BackupFile[] files) throws java.rmi.RemoteException { if (backupService == null) _initBackupServiceProxy(); try { int attachLength = ((BackupServiceSoapBindingStub) backupService).getAttachments().length; System.out.println(attachLength + " attachments"); } catch (Exception e) { e.printStackTrace(); } return backupService.uploadFiles(settings, files); } i added an output and it returns the correct amount of attachments namely one for each file. next step is to 'unpack' the attachments on the server and here I get 0 everytime: public static AttachmentPart[] getMessageAttachments() throws AxisFault { MessageContext msgContext = MessageContext.getCurrentContext(); if (null == msgContext) { System.out.println("cant get context"); return null; } System.out.println("name of msg:" + msgContext.getCurrentMessage ().getSOAPPartAsString()); Iterator it = msgContext.getCurrentMessage().getAttachments(); ArrayList attachments = new ArrayList(); while (it.hasNext()) { AttachmentPart part = (AttachmentPart) it.next(); attachments.add(part); } System.out.println(attachments.size() + " attachments"); return attachments.toArray(new AttachmentPart[0]); } } QUESTION: Simply - WHY. Im desperate and after hours of experimenting I ran out of ideas... Best regards, and thanks in advance, Dominik --------------------------------------------------------------------- To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org For additional commands, e-mail: axis-user-help@ws.apache.org