Professional Documents
Culture Documents
What is SOAP?
Lightweight protocol used for exchange of
messages in a decentralized, distributed
environment
Facilitates interoperability in a platform-
independent manner
Used for Remote Procedure Calls
W3C note defines the use of SOAP with XML as
payload and HTTP as transport, but other
transport protocols can be used such as SMTP
and SIP.
Advantages of SOAP
Uses HTTP which is widely used and
scalable
Wide remote system interoperability
Flexible for growth because of XML
properties
It but can be used for RPC.
Disadvantages of SOAP
No good way to describe the
serialization pattern (XML schema is
optional at this point)
Parsing of SOAP packet and mapping to
objects reduces performance
Doesn’t implement security because it is
a wire protocol—relies on HTTP
SOAP Elements
Envelope (mandatory)
Top element of the XML document representing the
message
Header (optional)
Determines how a recipient of a SOAP message should
message.
Typical use is for RPC calls and error reporting.
SOAP Elements
SOAP Encoding
Envelope package
Header/Body pattern
Similar to how HTTP works
Header
Body
Simple Example
<Envelope>
<Header>
<transId>345</transId>
</Header>
<Body>
<Add>
c = Add(n1, n2)
<n1>3</n1>
<n2>4</n2>
</Add>
</Body>
</Envelope>
SOAP Request
<SOAP-ENV:Envelope
xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/”
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/”>
<SOAP-ENV:Header>
<t:transId xmlns:t=“http://a.com/trans”>345</t:transId>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<m:Add xmlns:m=“http://a.com/Calculator”>
<n1>3</n1>
<n2>4</n2>
</m:Add>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
SOAP Request
Scopes the message to the SOAP
namespace describing the SOAP
<SOAP-ENV:Envelope envelope
xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/”
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/”>
...etc...
</SOAP-ENV:Envelope>
<m:Add xmlns:m=http://a.com/Calculator
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/”>
<a SOAP-ENC:arrayType=“xsd:int[3]”>
<SOAP-ENC:int>1</SOAP-ENC:int>
<SOAP-ENC:int>2</SOAP-ENC:int>
<SOAP-ENC:int>3</SOAP-ENC:int>
</a>
</m:Add>
Structures
typedef struct {
char author[64];
char title[200]
int year;
} Book;
Book crimAndPunishment;
B = Publish(crimeAndPunishment)
<m:Publish xmlns:m=http://a.com/Publishing
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/”>
<author type="xsd:string"/>Fyodor Dostoevsky</author>
<title type="xsd:string">Crime and Punishment</title>
<year type="xsd:integer">1917</year>
</m:Publish>
XML Schemas
Defines the structure, content and
semantics of XML documents
Simple types
Integers, strings, floats, time, etc.
Compound (complex) types
Arrays, structures
Example of XML Schema
<element name="Book">
<complexType>
<element name="author" type="xsd:string"/>
<element name=“title" type="xsd:string"/>
<element name=“year" type="xsd:integer"/>
</complexType>
</element>
<e:Book>
<author>Fyodor Dostoevsky</author>
<title>Crime and Punishment</title>
<year>1917</year>
</e:Book>
HTTP Request
POST /Calculator.pl HTTP/1.0
Host: www.a.com
Accept: text/*
Content-type: text/xml
Content-length: nnnn
SOAPAction: “http://www.a.com/Calculator#Add”
{CR}{LF}
<SOAP-ENV:Envelope
xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/”
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/”>
<SOAP-ENV:Header>
<t:transId xmlns:t=“http://a.com/trans”>345</t:transId>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<m:Add xmlns:m=“http://a.com/Calculator”>
<n1>3</n2>
<n1>4</n2>
</m:Add>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
HTTP Response
HTTP/1.0 200 OK
Content-type: text/xml
Content-length: nnnn
{CR}{LF}
<SOAP-ENV:Envelope
xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/”
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/”>
<SOAP-ENV:Header>
<t:transId xmlns:t=“http://a.com/trans”>345</t:transId>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<m:AddResponse xmlns:m=“http://a.com/Calculator”>
<result>7</result>
</m:AddResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
SOAPAction
The SOAPAction HTTP request header field can
be used to indicate the intent of the SOAP
HTTP request.
Used by servers, such as firewalls, to
appropriately filter SOAP request messages in
HTTP.
If value is empty string (""), intent of the SOAP
message is provided by the HTTP Request-URI.
No value means that there is no indication of
the intent of the message.
SOAPAction
POST /Calculator.pl HTTP/1.0 SOAPAction Intent
Host: www.a.com
Accept: text/*
Content-type: text/xml
Content-length: nnnn
SOAPAction: “http://www.a.com/Calculator#Add”
{CR}{LF}
<SOAP-ENV:Envelope
xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/”
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/”>
<SOAP-ENV:Header>
<t:transId xmlns:t=“http://a.com/trans”>345</t:transId>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<m:Add xmlns:m=“http://a.com/Calculator”>
...etc...
SOAP and SIP
SOAP and SIP Emergency
Notification
SIP (Session Initiation Protocol) is a text-based
signaling protocol used to establish multimedia
sessions on the Internet.
Similar to HTTP and SMTP
Extended to support event notification using
SUBSCRIBE and NOTIFY methods
Send a NOTIFY message with SOAP payload
Body of the SOAP message will invoke a remote
procedure relevant to the particular emergency event
Use XML Schema to specify different emergency
events handled and parameters needed
SOAP and SIP
<?xml version="1.0" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="EmergencyType">
<xs:sequence>
<xs:element name="Fire" type="Fire"/>
<xs:element name="Earthquake" type="Earthquake"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Fire">
<xs:sequence>
<xs:element name="location" type="string"/>
<xs:element name="severity" type="string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Earthquake">
<xs:sequence>
<xs:element name="location" type="string"/>
<xs:element name="scale" type="decimal"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
SOAP and SIP
NOTIFY sip:knarig@128.59.19.194:5063 SIP/2.0
Via: SIP/2.0/UDP 128.59.19.194:5063
CSeq: 3 NOTIFY
Contact: sip:knarig@128.59.19.194:5063
From: sip:cisalpino.cs.columbia.edu:5063
Call-Info: www.cs.columbia.edu/~knarig
Date: Wed, 24 Apr 2002 14:57:05 GMT
Content-Type: application/soap
Call-ID: 461662663@128.59.19.194
Event: emergency
To: sip:knarig@cs.columbia.edu
Content-Length: 494
<?xml version='1.0'?>
<:SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-
ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-
ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-
ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<:SOAP-ENV:Body>
<:Fire>
<:location xsi:type="xsd:string">Mudd</:location>
<:severity xsi:type="xsd:string">smoke</:severity>
</:Fire>
</:SOAP-ENV:Body>
</:SOAP-ENV:Envelope>
Columbia SIP user agent (sipc)
Media
Audio, video, text, white board
Screen sharing
Advanced
Presence, instant messaging
Conference control
Device control
Columbia SIP user agent (sipc)
Invoke
Emergency
Services
Fire
sos@leonia.nj.us
Notification server (sipd) Earthquake
5) Sipc gets XML schema
reference from notification
server that will generate a form
which queries for the event’s
properties. Sipc then updates its
subscription to the notification
server with the filtered 4) User
expressions subscribes to
event it wants
to be notified
of
Detailed overview of architecture
3)Sipc will process SOAP 1) Fire occurs and event
body and invoke the 2) Sipd will process parameters of generator notifies
procedure call—such as the fire and send a NOTIFY to sipc sipd
flashing of lights including SOAP body
Fire
Emergency@state.ny.us
Notification server (sipd) Earthquake
Example of Notification: Flashing of Lights
•Emergency event notification invokes
lamp
multiple calls of the SIP “DO” method
•This causes the lamp (connected to
the PC by an X10 device) to flash
serial port
DO sip:lamp@cs.columbia.edu
SIP/2.0
…..
<Control>
<Action>turn lamp on</Action>
</Control>
X10 device
Conclusions
SOAP is a scalable and widely used
wiring protocol
It is still not an industry standard and
needs fine-tuning
Using SIP and SOAP for emergency
notification is simple and effective
References
http://www.endurasoft.com/soap
http://www.w3.org/TR/SOAP/
http://www.microsoft.com/mind/0100/soap/s
oap.asp
Scribner K., Stiver M.C., Understanding SOAP,
Indianapolis, Indiana, 2000