Introduction To SOAP: Scott D. Stoller
Introduction To SOAP: Scott D. Stoller
1 2
3 4
Why Not Just Put Everything in the Header? Encoding Data in SOAP
• The Header is optional • SOAP permits arbitrary “encoding
• SOAP specializations for RPC require styles” and defines a default encoding
using the body to pass parameters and style
results (we’ll get to that later) • Based on XML-Schema
• Otherwise, no reason • Supports data types
• The SOAP spec notes that a body entry – All built-in XML-Schema types (e.g. string,
is semantically-equivalent to an optional float, integer, date, IDREF)
header entry (with “mustUnderstand” = – Derived types: enumerations, arrays,
0) structs, generic compound types
11 12
Encoding Data in SOAP: accessors Encoding Data in SOAP: structs
• Typed elements are called “accessors” • Structs are simple compound types
• Accessor types are specified in consisting of uniquely-named accessors,
externally-referenced XML-Schema e.g.
definitions
• Or with the xsi:type attribute, e.g. <naut:Ship>
<name>Titanic</name>
<a:uid xsi:type=“xsd:integer”> <length>882’</length>
4737 <height>104’</height>
</a:uid> <weight>46,328 tons</weight>
</naut:Ship>
13 14
17 18
RPC Example: Digital Library RPC Example: Catalog Search
• Catalog
– Represented by a URI, e.g. POST /catalog/ HTTP/1.1
http://www.lib.org/catalog/ Content-type: text/xml
– Supports one method: Search <SOAP-ENV:Envelope>
–Find items which match a particular query <SOAP-ENV:Body>
–Result: list of entries containing <lib:Search>
information about items <author>Kafka</author>
–Fault condition: malformed query </lib:Search>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
19 20
21 22
23 24
RPC Example: Circulation Checkout RPC Example: Circulation Checkout
… continued from last slide …
POST /circulation/ HTTP/1.1
Content-type: text/xml
<SOAP-ENV:Body>
<SOAP-ENV:Envelope> <lib:Checkout>
<SOAP-ENV:Header> <callNo>435.33</callNo>
<lib:PatronID </lib:Checkout>
SOAP-ENV:mustUnderstand=“1”>
007 </SOAP-ENV:Body>
</lib:PatronID> </SOAP-ENV:Envelope>
</SOAP-ENV:Header>
… continued …
25 26
27 28
31 32