How to handle attachments with axis

S

Stephan Koser

Hi,

can anybody tell me how to handle attachments with Axis? I don't want to
send Attachments as a method parameter but as real Attachment (using
addAttachmentPart()).
Using this function on the client side works well, but what ist to do on the
server side to read the attachments?
Usually I have a operation with parameters to call, that is a particular
method on the server side. So, when the Call is sent, the method on the
server is called, e.g.

public String fileApplication(String applicationName, Date date)

The application content was attached on the client as Attachment. How can I
access the attachments in the method fileApplication()?

The only way I know is to write a Servlet that catches the whole SOAPMessage
like the following:


public class SimpleJAXMServlet
extends javax.xml.messaging.JAXMServlet
implements javax.xml.messaging.ReqRespListener {


public void init(javax.servlet.ServletConfig servletConfig)
throws javax.servlet.ServletException {
super.init(servletConfig);
}

public javax.xml.soap.SOAPMessage onMessage
(javax.xml.soap.SOAPMessage message) {
...
Iterator attachments = message.getAttachments();
...

}
....
}

But this is the solution without Axis. Is there a way to use Axis to
retrieve the Attachments in a more comfortable way?

Thank you!
 
A

Andy Flowers

Take a look at the MessageContext class and use it like

MessageContext mc = MessageContext.getCurrentContext();

mc.getCurrentMessage().countAttachments();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top