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.
>