Hi Chinmoy,
thanks for your answer. It gave me a hint into the right direction. Now it is working. Yes, I did enable the SwA property, but it is only necessary to enable it on the client side, not on the server side as other tutorials mention as well. My problem was that I tried to get the content ids via the getContentIDList() method. This method only returns the content ids which have been parsed already. If I take the method you mention getAllContentIDs() or getContentIDSet(), then Axis parses the other attachments and returns a complete list of the content ids. @Axis2-Team: Please reflect this behavior in the javadoc that only the parsed content ids are returned by the getContentIDList(). Maybe I can help some other people with the same problem. J Matthias. Von: Chinmoy Chakraborty [mailto:[email protected]] Gesendet: Mittwoch, 13. Mai 2009 17:43 An: [email protected] Betreff: Re: Receiving swa attachments Hi Matthias, You need to set 'enableSwA' property to true in client and server side in order to work with SwA. I am assuming that you have done this. I tried with Axis2 1.4 and it works fine. You can try following code sample while receving the SwA attachment in the client side: ............................... mepClient.execute(true); MessageContext response = mepClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE); Attachments attachments = response.getAttachmentMap(); if (attachments == null) { return "No attachment"; } String[] attachmentIDs = attachments.getAllContentIDs(); for(int i = 0; i < attachmentIDs.length; i++){ if(!attachments.getSOAPPartContentID().equals(attachmentIDs[i])){ return attachments.getDataHandler(attachmentIDs[i]); } } Chinmoy On Wed, May 13, 2009 at 8:15 PM, <[email protected]> wrote: Hi group, I am getting a bit frustrated with swa attachments. For reason of compatibility I have to support them. I am trying to upload a file with swa to a service. I can see via tcpmon that my file is being sent, but on the server side I can't see the file in the attachments map. It is just not there. I have compared my coe with the swa example and also changed the swa example with my code, but I had no success. The code on the server side looks like this: MessageContext mctx = MessageContext.getCurrentMessageContext(); Attachments attachs = mctx.getAttachmentMap(); List<String> cids = attachs.getContentIDList(); String soapCid = attachs.getSOAPPartContentID(); String url = "not stored"; for (String cid : cids) { if (!cid.equals(soapCid)) { url = writeAttachmentToDisk(mctx.getAttachment(cid), cid); } } I filter out the soap part which is also listed in the attachments, but the list cids always only contains the soapPartContentID. In the articles on ws02 they always mention that you don't have to specify a special option to receive swa attachments. I am probably missing sth. out. Can anybody help me here? Thanks in advance, Matthias.
