background image

Overviewof SAAJ

<< SOAP with Attachments API for Java | Messages with Attachments >>
<< SOAP with Attachments API for Java | Messages with Attachments >>

Overviewof SAAJ

Overview of SAAJ
This section presents a high-level view of how SAAJ messaging works and explains concepts in
general terms. Its goal is to give you some terminology and a framework for the explanations
and code examples that are presented in the tutorial section.
The overview looks at SAAJ from two perspectives: messages and connections.
SAAJ Messages
SAAJ messages follow SOAP standards, which prescribe the format for messages and also
specify some things that are required, optional, or not allowed. With the SAAJ API, you can
create XML messages that conform to the SOAP 1.1 or 1.2 specification and to the WS-I Basic
Profile 1.1 specification simply by making Java API calls.
The Structure of an XML Document
An XML document has a hierarchical structure made up of elements, subelements,
subsubelements, and so on. You will notice that many of the SAAJ classes and interfaces
represent XML elements in a SOAP message and have the word element or SOAP (or both) in
their names.
An element is also referred to as a node. Accordingly, the SAAJ API has the interface Node,
which is the base class for all the classes and interfaces that represent XML elements in a SOAP
message. There are also methods such as SOAPElement.addTextNode, Node.detachNode, and
Node.getValue
, which you will see how to use in the tutorial section.
What Is in a Message?
The two main types of SOAP messages are those that have attachments and those that do not.
Messages with No Attachments
The following outline shows the very high-level structure of a SOAP message with no
attachments. Except for the SOAP header, all the parts listed are required to be in every SOAP
message.
I. SOAP message
A. SOAP part
1. SOAP envelope
a. SOAP header (optional)
b. SOAP body
The SAAJ API provides the SOAPMessage class to represent a SOAP message, the SOAPPart class
to represent the SOAP part, the SOAPEnvelope interface to represent the SOAP envelope, and so
on.
Figure 19­1
illustrates the structure of a SOAP message with no attachments.
Overview of SAAJ
The Java EE 5 Tutorial · September 2007
586