Name
Package javax.xml.soap
Synopsis
The javax.xml.soap
package contains the classes and
interfaces that make up the Soap with Attachments
API for Java (SAAJ). This package can be divided into two major
parts: a small number of classes and interfaces that obtain a SOAP
message and send it, and a much larger set that deal with the
structure of the message itself.
In order to send a message, you need to get an instance of the
SOAPConnection
class. As is the case with most of
the classes in this package, this class is abstract in order to allow
vendors to provide their own implementations. You can obtain a
SOAPConnection
object from the
SOAPConnectionFactory
class, which is another
abstract class that you can get an instance of by calling its
newInstance( )
method. A SOAP message is
represented by the SOAPMessage
class, which can be
obtained from a MessageFactory
.
SOAP messages are built from elements that are represented in the API
by the SOAPElement
interface. This interface
provides methods that allow you to add other elements and text nodes
to form a tree structure that is serialized to XML form when the
message is transmitted. Similarly, on receipt, a
SOAP message
is converted from XML form to a SOAPMessage
consisting of SOAPElement
s and
Text
nodes. SOAPElement
has
various subinterfaces that represent different parts of the SOAP
message, such as SOAPHeader
,
SOAPBody
, and SOAPFault
.
The body of a SOAP message can only contain valid XML data. Non-XML data can be included by adding one ...
Get Java Web Services in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.