The getContent method retrieves the contents and header from an AttachmentPart object. Using DataContentHandler objects, you can handle the attachment as a Java object corresponding to the MIME type or as an InputStream containing the content as bytes.
Apache SOAP also handles XML using a DOM-oriented model. Methods for handling attachments in message-encoding style SOAP are provided in the classes; org.apache.soap.messaging.Message, org.apache.soap.rpc.Call, or org.apache.soap.rpc.Response. Use addBodyPart() to add a an attachment as a javax.mail.internet.MimeBodyPart object. Use findBodyPart() to retrieve attachments using a Content-URI and getBodyPart() to retrieve attachments using a location within a message.
Another alternative to JAXM and Apache SOAP is Axis, the next generation of Apache SOAP. Axis handles XML using SAX which can result in a performance boost for you, depending upon how you are using it.
If you are comfortable with a DOM-oriented model, JAXM or Apache SOAP are both viable options, however, Apache SOAP is slightly more mature. If you need to interface as a new service provider, JAXM is a more elegant option. If you need the performance that SAX can offer, Axis is probably your best choice.
This was first published in July 2002