SCDJWS Study Guide: SAAJ
Printer-friendly version |
Mail this to a friend
Introduction
The SOAP with
Attachments API for Java (SAAJ) provides a standard way to send XML
documents over the Internet from the Java platform. It provides a
convenient API for constructing SOAP messages without having to
directly crete the XML by yourself. You
can use the SAAJ API to write SOAP messaging applications directly
rather than using
the JAX-RPC. By simple making method calls using SAAJ API, you can
communicate with other web services directly by using SOAP-based XML
messages, and you can optionally send and
receive these types of messages over the Internet.
The SAAJ API conforms to the Simple Object Access Protocol (SOAP) 1.1 specification and the SOAP with Attachments specification. It is one of the two packages for XML messaging:
- javax.xml.soap -- the package defined in the SOAP with Attachments API for Java (SAAJ) 1.1 specification. This is the basic package for SOAP messaging, which contains the API for creating and populating a SOAP message. This package has all the API necessary for sending request-response messages. The API in the javax.xml.soap package allows you to do the following:
|
- javax.xml.messaging -- the package defined in the Java API for XML Messaging (JAXM) 1.1 specification. This package contains the base level, interoperable API targeted at a new class of "store and forward" message brokers often referred to as messaging providers. (Where to get information about messaging providers appears later in this section.) When messaging provider products become available, the JAXM API can be used to connect to them. Note that the javax.xml.messaging package is not part of the J2EE 1.4 platform.
Originally, both packages were defined in the JAXM 1.0 specification. The javax.xml.soap package has been separated out and expanded into the SAAJ 1.1 specification so that now it has no dependencies on the javax.xml.messaging package and thus can be used independently. Among other things, SAAJ added the API for creating XML fragments, which makes it especially helpful for developing JAX-RPC applications. The SAAJ API belongs to javax.xml.soap.* package.
The javax.xml.messaging
package, defined in the JAXM 1.1
specification, maintains its dependency on the java.xml.soap package
because the soap package contains the API used for creating and
manipulating SOAP messages. This means that the SAAJ API can be used by
itself, but the JAXM API cannot be used unless the SAAJ API is present.
Using SAAJ, a client can create and send SOAP messages in a
point-to-point model. SAAJ clients can
only engage in synchronous request/response message exchanges. JAXM
defines the API for xml messaging using a messaging provider have
access to additional message exchange modes such as asynchronous
messaging. JAXM depends on the SOAP with Attachments API for Java
(SAAJ), which defines the API for operating on the SOAP with
attachments message model in Java.
Please reference to Sun
J2EE 1.4 Tutorial Document for more detail about SAAJ.