Ask the Expert

What is the difference between SAAJ/JAXM and Apache SOAP?

SAAJ/JAXM vs. Apache SOAP: What are the differences between these two and which is better for using SOAP with attachments?

    Requires Free Membership to View

JAXM is a Service Provicer Interface (SPI) specification. JAXM handles XML using a DOM-oriented model and allows you to examine the contents of a SOAP message by retrieving individual attachment parts. JAXM encapsulates attachments in an object called an AttachmentPart. You set the MIME headers for each AttachmentPart object, then add it to a message.

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: