Information Technology Reference
In-Depth Information
in XML format. In June 2003, SOAP 1.2 3 became a W3C Recommendation
and has been gaining momentum ever since, being adopted in most Web-
service-based applications. While in theory (and also in practice), instance
messages of services communicating over HTTP could be encoded directly in
HTTP/get or post requests, SOAP adds a more rigid framework especially
tailored for XML message exchange on top, in fact, nowadays the term “Web
services” is often used synonymously for “Web services communicating over
SOAP” which gives us justification enough to further explain the basics of
this fundamental standard protocol here.
SOAP aims to achieve maximum acceptance and flexibility by the provi-
sion of a framework in which application-specific information may be conveyed
in an extensible manner, without making any up-front commitment to the se-
mantics of application-specific data. Also, SOAP provides a full description of
the required actions that must taken by a SOAP node upon receiving a SOAP
message. This can, for example, be achieved by including a mustUnderstand
header, i.e. an XML element that describes processing instructions such as
requiring support for some transaction protocol. Without specifying a con-
crete set of instruction, the SOAP standard specifies that if such an element
cannot be understood by a receiving node, it must not process the request
but instead issue a fault message.
A SOAP message itself is just an XML document. Listing 4.1 shows a
simple example of a typical SOAP document that is used to invoke a weather
service. Within a SOAP envelope, optional header and body elements are
present. To keep the example short, we have omitted the header element,
which normally contains processing instructions as explained in the previous
paragraph. The body contains the actual payload of the message. In this case
it is an XML node - conforming to the schema definition of the GetWeather
message of some service within the example - containing two strings indicat-
ing a city, described by its name and country. Additionally, SOAP defines a
standardized way of handling faults in a message exchange by defining spe-
cific XML elements for it (such as faultcode and faultstring ,whicheases
automatic processing.
< ? xml version =”1.0” encoding=”UTF 8”? >
< soap:Envelope xmlns:soap=”http://schemas.xmlsoap.org/soap/envelope/” >
< soap:Body >
< GetWeather xmlns=”http://www.webservicex.net” >
< CityName > Innsbruck < /CityName >
< CountryName > Austria < /CountryName >
< /GetWeather >
< /soap:Body >
< /soap:Envelope >
Listing 4.1. An example SOAP message
Particulary interesting in the Web context is the protocol-binding frame-
work of SOAP. Basically, SOAP messages can be sent using a variety of pro-
3 For various reasons, the original acronym SOAP no longer represents the name
in the most recent version.
Search WWH ::




Custom Search