soap simple object access protocol n.
Skip this Video
Loading SlideShow in 5 Seconds..
SOAP (Simple Object Access Protocol) PowerPoint Presentation
Download Presentation
SOAP (Simple Object Access Protocol)

SOAP (Simple Object Access Protocol)

236 Vues Download Presentation
Télécharger la présentation

SOAP (Simple Object Access Protocol)

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. SOAP (Simple Object Access Protocol) Knarig Arabshian Department of Computer Science Columbia University April 24, 2002

  2. Overview • What is SOAP? • Details of the protocol • SOAP and SIP Emergency Notification • Conclusion • References

  3. What is SOAP?

  4. 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.

  5. 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.

  6. 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

  7. SOAP 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.

  8. SOAP Elements • SOAP Encoding • Envelope package • Header/Body pattern • Similar to how HTTP works Header Body

  9. Simple Example <Envelope> <Header> <transId>345</transId> </Header> <Body> <Add> <n1>3</n1> <n2>4</n2> </Add> </Body> </Envelope> c = Add(n1, n2)

  10. SOAP Request <SOAP-ENV:Envelope xmlns:SOAP-ENV=“” SOAP-ENV:encodingStyle="”> <SOAP-ENV:Header> <t:transId xmlns:t=“”>345</t:transId> </SOAP-ENV:Header> <SOAP-ENV:Body> <m:Add xmlns:m=“”> <n1>3</n1> <n2>4</n2> </m:Add> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

  11. SOAP Request Scopes the message to the SOAP namespace describing the SOAP envelope <SOAP-ENV:Envelope xmlns:SOAP-ENV=“” SOAP-ENV:encodingStyle="”> ...etc... </SOAP-ENV:Envelope> Establishes the type of encoding that is used within the message (the different data types supported)

  12. SOAP Request Qualifies transId ...etc... <SOAP-ENV:Header> <t:transId xmlns:t=“”>1234</t:transId> </SOAP-ENV:Header> <SOAP-ENV:Body> <m:Add xmlns:m=“”> <n1>3</n1> <n1>4</n2> </m:Add> </SOAP-ENV:Body> ...etc... Defines the method

  13. SOAP Response <SOAP-ENV:Envelope xmlns:SOAP-ENV=“” SOAP-ENV:encodingStyle="”> <SOAP-ENV:Header> <t:transId xmlns:t=“”>345</t:transId> </SOAP-ENV:Header> <SOAP-ENV:Body> <m:AddResponse xmlns:m=“”> <result>7</result> </m:AddResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

  14. SOAP Response <SOAP-ENV:Envelope xmlns:SOAP-ENV=“” SOAP-ENV:encodingStyle="”> <SOAP-ENV:Header> <t:transId xmlns:t=“”>345</t:transId> </SOAP-ENV:Header> <SOAP-ENV:Body> <m:AddResponse xmlns:m=“”> <result>7</result> </m:AddResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope> Response typically uses method name with “Response” appended

  15. SOAP 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

  16. SOAP 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.

  17. SOAP Fault Example <SOAP-ENV:Envelope xmlns:SOAP-ENV=“” SOAP-ENV:encodingStyle="”> <SOAP-ENV:Body> <SOAP-ENV:Fault> <faultcode>SOAP-ENV:Server</faultcode> <faultstring>Internal Application Error</faultstring> <detail xmlns:f=“”> <f:errorCode>794634</f:errorCode> <f:errorMsg>Divide by zero</f:errorMsg> </detail> </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

  18. SOAP 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

  19. Arrays int a[3] = {1, 2, 3}; b = Add([in]a); <m:Add xmlns:m= xmlns:SOAP-ENC="”> <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>

  20. Structures typedef struct { char author[64]; char title[200] int year; } Book; Book crimAndPunishment; B = Publish(crimeAndPunishment) <m:Publish xmlns:m= xmlns:SOAP-ENC="”> <author type="xsd:string"/>Fyodor Dostoevsky</author> <title type="xsd:string">Crime and Punishment</title> <year type="xsd:integer">1917</year> </m:Publish>

  21. XML Schemas • Defines the structure, content and semantics of XML documents • Simple types • Integers, strings, floats, time, etc. • Compound (complex) types • Arrays, structures

  22. 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>

  23. HTTP Request POST / HTTP/1.0 Host: Accept: text/* Content-type: text/xml Content-length: nnnn SOAPAction: “” {CR}{LF} <SOAP-ENV:Envelope xmlns:SOAP-ENV=“” SOAP-ENV:encodingStyle="”> <SOAP-ENV:Header> <t:transId xmlns:t=“”>345</t:transId> </SOAP-ENV:Header> <SOAP-ENV:Body> <m:Add xmlns:m=“”> <n1>3</n2> <n1>4</n2> </m:Add> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

  24. HTTP Response HTTP/1.0 200 OK Content-type: text/xml Content-length: nnnn {CR}{LF} <SOAP-ENV:Envelope xmlns:SOAP-ENV=“” SOAP-ENV:encodingStyle="”> <SOAP-ENV:Header> <t:transId xmlns:t=“”>345</t:transId> </SOAP-ENV:Header> <SOAP-ENV:Body> <m:AddResponse xmlns:m=“”> <result>7</result> </m:AddResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

  25. 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.

  26. SOAPAction Intent SOAPAction POST / HTTP/1.0 Host: Accept: text/* Content-type: text/xml Content-length: nnnn SOAPAction: “” {CR}{LF} <SOAP-ENV:Envelope xmlns:SOAP-ENV=“” SOAP-ENV:encodingStyle="”> <SOAP-ENV:Header> <t:transId xmlns:t=“”>345</t:transId> </SOAP-ENV:Header> <SOAP-ENV:Body> <m:Add xmlns:m=“”> ...etc...

  27. SOAP and SIP

  28. 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

  29. SOAP and SIP <?xml version="1.0" ?><xs:schema xmlns:xs=""> <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>

  30. SOAP and SIP NOTIFY sip:knarig@ SIP/2.0 Via: SIP/2.0/UDP CSeq: 3 NOTIFY Contact: sip:knarig@ From: Call-Info: Date: Wed, 24 Apr 2002 14:57:05 GMT Content-Type: application/soap Call-ID: 461662663@ Event: emergency To: Content-Length: 494 <?xml version='1.0'?><:SOAP-ENV:Envelope xmlns:xsi="" xmlns:SOAP-ENV="" xmlns:SOAP-ENC="" SOAP-ENV:encodingStyle="" xmlns:xsd=""><: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>

  31. Columbia 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

  32. Columbia 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

  33. Detailed overview of architecture 3) Sipc contacts notification server and gets list of emergency events user can subscribe to 2) Generic emergency address: is added to sipc 1) Event generators publish their events to notification server Fire 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 expressions 4) User subscribes to event it wants to be notified of

  34. Detailed overview of architecture 3)Sipc will process SOAP body and invoke the procedure call—such 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 Notification server (sipd) Earthquake

  35. Example 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 SIP/2.0 ….. <Control> <Action>turn lamp on</Action> </Control> X10 device

  36. 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

  37. References • • • • Scribner K., Stiver M.C., Understanding SOAP, Indianapolis, Indiana, 2000