Title: SOAP (Simple Object Access Protocol)
1SOAP (Simple Object Access Protocol)
- Knarig Arabshian
- Department of Computer Science
- Columbia University
- knarig_at_cs.columbia.edu
- April 24, 2002
2Overview
- What is SOAP?
- Details of the protocol
- SOAP and SIP Emergency Notification
- Conclusion
- References
3What is SOAP?
4What 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.
5Advantages 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.
6Disadvantages 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 - Doesnt implement security because it is a wire
protocolrelies on HTTP
7SOAP Elements
- Envelope (mandatory)
- Top element of the XML document representing the
message - Header (optional)
- Determines how a recipient of a SOAP message
should process the message - Adds features to the SOAP message such as
authentication, transaction management, payment,
message routes, etc - Body (mandatory)
- Exchanges information intended for the recipient
of the message. - Typical use is for RPC calls and error reporting.
8SOAP Elements
- SOAP Encoding
- Envelope package
- Header/Body pattern
- Similar to how HTTP works
Header
Body
9Simple Example
ltEnvelopegt ltHeadergt lttransIdgt345lt/transId
gt lt/Headergt ltBodygt ltAddgt
ltn1gt3lt/n1gt ltn2gt4lt/n2gt lt/Addgt
lt/Bodygt lt/Envelopegt
c Add(n1, n2)
10SOAP Request
ltSOAP-ENVEnvelope xmlnsSOAP-ENVhttp//sche
mas.xmlsoap.org/soap/envelope/
SOAP-ENVencodingStyle"http//schemas.xmlsoap.org
/soap/encoding/gt ltSOAP-ENVHeadergt
ltttransId xmlnsthttp//a.com/transgt345lt/ttra
nsIdgt lt/SOAP-ENVHeadergt ltSOAP-ENVBodygt
ltmAdd xmlnsmhttp//a.com/Calculatorgt
ltn1gt3lt/n1gt ltn2gt4lt/n2gt
lt/mAddgt lt/SOAP-ENVBodygt lt/SOAP-ENVEnvelopegt
11SOAP Request
Scopes the message to the SOAP namespace
describing the SOAP envelope
ltSOAP-ENVEnvelope xmlnsSOAP-ENVhttp//schem
as.xmlsoap.org/soap/envelope/
SOAP-ENVencodingStyle"http//schemas.xmlsoap.org
/soap/encoding/gt ...etc... lt/SOAP-ENVEnvelope
gt
Establishes the type of encoding that is used
within the message (the different data types
supported)
12SOAP Request
Qualifies transId
...etc... ltSOAP-ENVHeadergt
ltttransId xmlnsthttp//a.com/transgt1234lt/ttr
ansIdgt lt/SOAP-ENVHeadergt ltSOAP-ENVBodygt
ltmAdd xmlnsmhttp//a.com/Calculatorgt
ltn1gt3lt/n1gt ltn1gt4lt/n2gt
lt/mAddgt lt/SOAP-ENVBodygt ...etc...
Defines the method
13SOAP Response
ltSOAP-ENVEnvelope xmlnsSOAP-ENVhttp//sche
mas.xmlsoap.org/soap/envelope/
SOAP-ENVencodingStyle"http//schemas.xmlsoap.org
/soap/encoding/gt ltSOAP-ENVHeadergt
ltttransId xmlnsthttp//a.com/transgt345lt/ttra
nsIdgt lt/SOAP-ENVHeadergt ltSOAP-ENVBodygt
ltmAddResponse xmlnsmhttp//a.com/Calculator
gt ltresultgt7lt/resultgt
lt/mAddResponsegt lt/SOAP-ENVBodygt lt/SOAP-ENVEn
velopegt
14SOAP Response
ltSOAP-ENVEnvelope xmlnsSOAP-ENVhttp//sch
emas.xmlsoap.org/soap/envelope/
SOAP-ENVencodingStyle"http//schemas.xmlsoap.org
/soap/encoding/gt ltSOAP-ENVHeadergt
ltttransId xmlnsthttp//a.com/transgt345lt/ttra
nsIdgt lt/SOAP-ENVHeadergt ltSOAP-ENVBodygt
ltmAddResponse xmlnsmhttp//a.com/Calculator
gt ltresultgt7lt/resultgt
lt/mAddResponsegt lt/SOAP-ENVBodygt lt/SOAP-ENVEn
velopegt
Response typically uses method name with
Response appended
15SOAP Fault
- Used to carry error and/or status information
within a SOAP message - Appears within the SOAP body
- Defines the following
- faultcode (mandatory)
- algorithmic mechanism for identifying the fault
- defined in the SOAP spec
- Faultstring (mandatory)
- human readable explanation of the fault
16SOAP Fault
- faultactor (optional)
- information about who caused the fault to happen
- URI value identifying the source
- Detail
- error information related only to the Body
element. - if not present then indicates that the fault is
not related to the Body element.
17SOAP Fault Example
ltSOAP-ENVEnvelope xmlnsSOAP-ENVhttp//sch
emas.xmlsoap.org/soap/envelope/
SOAP-ENVencodingStyle"http//schemas.xmlsoap.org
/soap/encoding/gt ltSOAP-ENVBodygt
ltSOAP-ENVFaultgt ltfaultcodegtSOAP-ENVServ
erlt/faultcodegt ltfaultstringgtInternal
Application Errorlt/faultstringgt ltdetail
xmlnsfhttp//www.a.com/CalculatorFaultgt
ltferrorCodegt794634lt/ferrorCodegt
ltferrorMsggtDivide by zerolt/ferrorMsggt
lt/detailgt lt/SOAP-ENVFaultgt
lt/SOAP-ENVBodygt lt/SOAP-ENVEnvelopegt
18SOAP Encoding
- Based on a simple type system that has common
features with programming languages and databases - Types are either simple (scalar) or compound
which is a composite of several parts - An XML schema which is consistent with this type
system can be constructed - Use of schemas is encouraged but NOT required
19Arrays
- int a3 1, 2, 3
- b Add(ina)
ltmAdd xmlnsmhttp//a.com/Calculator xmlnsSOAP-
ENC"http//schemas.xmlsoap.org/soap/encoding/gt
lta SOAP-ENCarrayTypexsdint3gt
ltSOAP-ENCintgt1lt/SOAP-ENCintgt
ltSOAP-ENCintgt2lt/SOAP-ENCintgt
ltSOAP-ENCintgt3lt/SOAP-ENCintgt lt/agt lt/mAddgt
20Structures
- typedef struct
- char author64
- char title200
- int year
- Book
- Book crimAndPunishment
- B Publish(crimeAndPunishment)
- ltmPublish xmlnsmhttp//a.com/Publishing
- xmlnsSOAP-ENC"http//schemas.xmlsoap.org/soap/en
coding/gt - ltauthor type"xsdstring"/gtFyodor
Dostoevskylt/authorgt - lttitle type"xsdstring"gtCrime and
Punishmentlt/titlegt - ltyear type"xsdinteger"gt1917lt/yeargt
- lt/mPublishgt
21XML Schemas
- Defines the structure, content and semantics of
XML documents - Simple types
- Integers, strings, floats, time, etc.
- Compound (complex) types
- Arrays, structures
22Example of XML Schema
ltelement name"Book"gtltcomplexTypegt  ltelement
name"author" type"xsdstring"/gt  ltelement
nametitle" type"xsdstring"/gt  ltelement
nameyear" type"xsdinteger"/gtlt/complexTypegt lt/
elementgt
lteBookgt   ltauthorgtFyodor Dostoevskylt/authorgt  Â
lttitlegtCrime and Punishmentlt/titlegt   ltyeargt1917lt
/yeargtlt/eBookgt
23HTTP 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/CalculatorAdd CRLF ltSOAP-E
NVEnvelope xmlnsSOAP-ENVhttp//schemas.xml
soap.org/soap/envelope/ SOAP-ENVencodingStyle
"http//schemas.xmlsoap.org/soap/encoding/gt
ltSOAP-ENVHeadergt ltttransId
xmlnsthttp//a.com/transgt345lt/ttransIdgt
lt/SOAP-ENVHeadergt ltSOAP-ENVBodygt
ltmAdd xmlnsmhttp//a.com/Calculatorgt
ltn1gt3lt/n2gt ltn1gt4lt/n2gt lt/mAddgt
lt/SOAP-ENVBodygt lt/SOAP-ENVEnvelopegt
24HTTP Response
HTTP/1.0 200 OK Content-type text/xml Content-len
gth nnnn CRLF ltSOAP-ENVEnvelope
xmlnsSOAP-ENVhttp//schemas.xmlsoap.org/soap/en
velope/ SOAP-ENVencodingStyle"http//schemas
.xmlsoap.org/soap/encoding/gt
ltSOAP-ENVHeadergt ltttransId
xmlnsthttp//a.com/transgt345lt/ttransIdgt
lt/SOAP-ENVHeadergt ltSOAP-ENVBodygt
ltmAddResponse xmlnsmhttp//a.com/Calculatorgt
ltresultgt7lt/resultgt
lt/mAddResponsegt lt/SOAP-ENVBodygt lt/SOAP-ENVEn
velopegt
25SOAPAction
- 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.
26SOAPAction
POST /Calculator.pl HTTP/1.0 Host
www.a.com Accept text/ Content-type
text/xml Content-length nnnn SOAPAction
http//www.a.com/CalculatorAdd CRLF ltSOAP-E
NVEnvelope xmlnsSOAP-ENVhttp//schemas.xml
soap.org/soap/envelope/ SOAP-ENVencodingStyle
"http//schemas.xmlsoap.org/soap/encoding/gt
ltSOAP-ENVHeadergt ltttransId
xmlnsthttp//a.com/transgt345lt/ttransIdgt
lt/SOAP-ENVHeadergt ltSOAP-ENVBodygt
ltmAdd xmlnsmhttp//a.com/Calculatorgt ...etc..
.
27SOAP and SIP
28SOAP 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
29SOAP and SIP
- lt?xml version"1.0" ?gtltxsschema
xmlnsxs"http//www.w3.org/2001/XMLSchema"gt - ltxscomplexType name"EmergencyType"gt
- ltxssequencegt
- ltxselement name"Fire" type"Fire"/gt
- ltxselement name"Earthquake"
type"Earthquake"/gt - lt/xssequencegt
- lt/xscomplexTypegt
- ltxscomplexType name"Fire"gt
- ltxssequencegt
- ltxselement name"location" type"string"/gt
- ltxselement name"severity"
type"string"/gtlt/xssequencegt - lt/xscomplexTypegt
- ltxscomplexType name"Earthquake"gt
- ltxssequencegt
- ltxselement name"location" type"string"/gt
- ltxselement name"scale" type"decimal"/gt
- lt/xssequencegt
- lt/xscomplexTypegt
- lt/xsschemagt
30SOAP and SIP
NOTIFY sipknarig_at_128.59.19.1945063 SIP/2.0 Via
SIP/2.0/UDP 128.59.19.1945063 CSeq 3
NOTIFY Contact sipknarig_at_128.59.19.1945063 From
sipcisalpino.cs.columbia.edu5063 Call-Info
www.cs.columbia.edu/knarig Date Wed, 24 Apr
2002 145705 GMT Content-Type
application/soap Call-ID 461662663_at_128.59.19.194
Event emergency To sipknarig_at_cs.columbia.edu Co
ntent-Length 494
lt?xml version'1.0'?gtltSOAP-ENVEnvelope
xmlnsxsi"http//www.w3.org/1999/XMLSchema-instan
ce" xmlnsSOAP-ENV"http//schemas.xmlsoap.org/soa
p/envelope/" xmlnsSOAP-ENC"http//schemas.xmlsoa
p.org/soap/encoding/" SOAP-ENVencodingStyle"http
//schemas.xmlsoap.org/soap/encoding/"
xmlnsxsd"http//www.w3.org/1999/XMLSchema"gtltSO
AP-ENVBodygtltFiregt ltlocation
xsitype"xsdstring"gtMuddlt/locationgt
ltseverity xsitype"xsdstring"gtsmokelt/severitygt
lt/Firegt lt/SOAP-ENVBodygtlt/SOAP-ENVEnvelopegt
31Columbia SIP user agent (sipc)
- Media
- Audio, video, text, white board
- Screen sharing
- Shared web browsing
- Advanced
- Presence, instant messaging
- Conference control
- Emergency notification and handling
- Device control
32Columbia SIP user agent (sipc)
Invoke Emergency Services
Calls 911 by connecting to the local PSAP
Receive emergency notification alerts from
various event servers that user has subscribed to
33Detailed overview of architecture
3) Sipc contacts notification server and gets
list of emergency events user can subscribe to
2) Generic emergency address emergenycy_at_state.ny.
us is added to sipc
1) Event generators publish their events to
notification server
Fire
sos_at_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 events properties. Sipc
then updates its subscription to the notification
server with the filtered expressions
4) User subscribes to event it wants to be
notified of
34Detailed overview of architecture
3)Sipc will process SOAP body and invoke the
procedure callsuch as flashing of lights
1) Fire occurs and event generator notifies sipd
2) Sipd will process parameters of the fire and
send a NOTIFY to sipc including SOAP body
Fire
Emergency_at_state.ny.us Notification server (sipd)
Earthquake
35Example of Notification Flashing of Lights
- Emergency event notification invokes multiple
calls of the SIP DO method - This causes the lamp (connected to the PC by an
X10 device) to flash
lamp
serial port
DO siplamp_at_cs.columbia.edu SIP/2.0 .. ltControlgt
ltActiongtturn lamp onlt/Actiongt lt/Controlgt
X10 device
36Conclusions
- 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
37References
- http//www.endurasoft.com/soap
- http//www.w3.org/TR/SOAP/
- http//www.microsoft.com/mind/0100/soap/soap.asp
- Scribner K., Stiver M.C., Understanding SOAP,
Indianapolis, Indiana, 2000