SOAP is a protocol for exchanging
XML-based messages over a network, and is used for sending messages
between web services and their clients. Client software sends SOAP
messages to web services to invoke web service operations. Web services
return the operation results to clients using another SOAP message.
The XML that represents a SOAP message that is sent to invoke
a web service operation is comprised of the message envelope, header,
and body:
-
Envelope:
-
The Envelope element is the root element of the XML document
that represents the SOAP message. This element contains the message
header and body.
-
Header:
-
The Header element contains information that is not directly
related to the web service operation. This element serves as a mechanism
for providing information to the software that processes the message.
For example, the header is typically used to transfer user credentials
for authentication reasons. It is optional to include the Header
element unless the web service requires it.
-
Body:
-
The Body element contains one element that represents a call
to the web service operation that is being invoked. The element
type is the name of the operation. The operation element contains
elements that represent the operation parameters. These element
types are the names of the parameters, and contain the parameter
values.
The name of the web service operations, as well as
the parameter names and data types are defined in the web service
definition. Most web service clients retrieve and interpret the
definition automatically.
Namespaces
The
Envelope element must be prefixed with a namespace alias whose declaration
uses
"http://schemas.xmlsoap.org/soap/envelope/"
as the
namespace identifier. If the following namespace declaration is
used for this namespace, the Header element is prefixed with
soapenv
:
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
Other
namespaces that are declared are namespaces that the web service definition
defines. These namespaces are used to prefix the XML elements that are
associated with the web service operation. For example, web services
for invoking activated processes use the namespace identifier
"http://adobe.com/idp/services"
.
Example
The
following XML code is an example SOAP message element that represents
a call to the web service’s operation named
operation_name
.
The operation takes one parameter named
parameter_name
.
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://foo.net/services">
<soapenv:Header />
<soapenv:Body>
<ser:operation_name>
<ser:parameter_name>?</ser:parameter_name>
</ser:operation_name>
</soapenv:Body>
</soapenv:Envelope>
|
|
|