Well, I am doing a similar thing..my code for receiving attachments works -
Client snippet... String[] array = new String[1]; array[0] = "hello"; org.apache.axis.MessageContext messageContext = call.getMessageContext(); org.apache.axis.Message currentMessage = messageContext.getCurrentMessage(); currentMessage.addAttachmentPart(new AttachmentPart(dh)); String returnValue = (String) call.invoke(array); org.apache.axis.Message responseMessage = messageContext.getResponseMessage(); System.out.println("Number of attachments is -> "+responseMessage.countAttachments()); Server code snippet.. org.apache.axis.MessageContext messageContext = org.apache.axis.MessageContext.getCurrentContext(); org.apache.axis.Message responseMessage = messageContext.getResponseMessage(); org.apache.axis.Message requestMessage = messageContext.getResponseMessage(); //responseMessage.getAttachmentsImpl().setSendType(org.apache.axis.attachments.Attachments.SEND_TYPE_DIME); responseMessage.addAttachmentPart(new AttachmentPart(dh)); responseMessage.addAttachmentPart(new AttachmentPart(dh1)); I would check if to see if the attachments are being attached properly on the server side. -Srinivas -----Original Message----- From: Greg Hess [mailto:[EMAIL PROTECTED] Sent: Thursday, November 13, 2003 1:37 PM To: [EMAIL PROTECTED] Subject: Client accessing MessageContext? Hi All, Can anyone provide me with an example of a client reading an attachment by hand. My service does not expose DataHandlers in the method signature and just adds/receives the attachments by hand. I have followed the Fear Of Attachments example in the implementation. All is working fine as far as the client sending up an attachment to the server. But when my client receives an attachment from the server and I try and read it the same way as the server using the following getAttachments(). The MessageContext is null. I am not sure what is wrong. Does the client not have access to a message context? private AttachmentPart[] getMessageAttachments() throws AxisFault { MessageContext msgContext = MessageContext.getCurrentContext(); System.out.println("MESSAGE CONTEXT=" + msgContext); Message reqMsg = msgContext.getResponseMessage(); Attachments messageAttachments = reqMsg.getAttachmentsImpl(); if (messageAttachments == null) { return new AttachmentPart[0]; } int attachmentCount = messageAttachments.getAttachmentCount(); AttachmentPart attachments[] = new AttachmentPart[attachmentCount]; Iterator it = messageAttachments.getAttachments().iterator(); int count = 0; while(it.hasNext()) { AttachmentPart part = (AttachmentPart) it.next(); attachments[count++] = part; } return attachments; } Greg Hess Software Engineer Wrapped Apps Corporation 275 Michael Cowpland Dr. Suite 201 Ottawa, Ontario K2M 2G2 Tel: (613) 591 -7552 Fax: (613) 591-0523 1 (877) 388-6742 www.wrappedapps.com