background image

Messages with No Attachments

<< What Is in a Message | Messages with Attachments >>
<< What Is in a Message | Messages with Attachments >>
120
SOAP
WITH
A
TTACHMENTS
API
FOR
J
AVA
The
SOAPHeader
object can include one or more headers that contain metadata
about the message (for example, information about the sending and receiving
parties). The
SOAPBody
object, which always follows the
SOAPHeader
object if
there is one, contains the message content. If there is a
SOAPFault
object (see
Using SOAP Faults, page 145), it must be in the
SOAPBody
object.
Figure 5­1
SOAPMessage
Object with No Attachments
Messages with Attachments
A SOAP message may include one or more attachment parts in addition to the
SOAP part. The SOAP part must contain only XML content; as a result, if any of
the content of a message is not in XML format, it must occur in an attachment
part. So if, for example, you want your message to contain a binary file, your
message must have an attachment part for it. Note that an attachment part can
contain any kind of content, so it can contain data in XML format as well. Figure
5­2
shows the high-level structure of a SOAP message that has two attachments.