1 / 19

Simple Object Access Protocol

Simple Object Access Protocol. CS409 Application Services. Even Semester 2007. Web Service Requirements. An industry standard web service : Provide a service description, at least, a WSDL document. Capable of transporting XML documents using SOAP over HTTP.

ima-hess
Télécharger la présentation

Simple Object Access Protocol

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Simple Object Access Protocol CS409 Application Services Even Semester 2007

  2. Web Service Requirements • An industry standard web service : • Provide a service description, at least, a WSDL document. • Capable of transporting XML documents using SOAP over HTTP. • Be registered with a discovery agent. • Able to act as both the requestor and provider of a service (optional). • e.g: provider asking for status information.

  3. SOAP Definition • A standard to access web services. • Establishes standard message format that consists of XML document. • Allows the provider and receiver of XML document to effectively communicate over the network. • Able to process document and RPC centric data, as well as attachments.

  4. Data Business Rules Business Rules Data Service Interface Service Interface Presentation Presentation SOAP message SOAP message Role of SOAP Application B Application A Fig 1. SOAP Standpoint

  5. SOAP Messaging Framework • SOAP node: • A processing logic responsible for processing tasks on SOAP messages. • Also known as SOAP server, SOAP listener, SOAP routers. • SOAP node types: • Senders. • Receiver. • Intermediary.

  6. SOAP Node Types Message path SOAP Sender Service Requestor SOAP Intermediary Intermediary Service SOAP Receiver Service Provider SOAP Intermediary Intermediary Service Initial Sender Ultimate Receiver Fig 2. SOAP Node

  7. Header BlockBlock. . . Body BlockBlock. . . SOAP Structure Unit of communication Envelope Attributes of the communication Message of communication: method name with arguments or document Fig 3. SOAP Message Structure

  8. SOAP Envelope • Marks the start and the end of SOAP message. • It is the container/packaging of the message. • Example: <?xml version=“1.0” encoding=“UTF-8”> <SOAP-ENV:Envelope xmlns:SOAP-ENV=“http://www.w3.org/2003/05/soap-envelope” > <SOAP-ENV:Header> . . . </SOAP-ENV:Header> <SOAP-ENV:Body> . . . </SOAP-ENV:Body> </SOAP-ENV:Envelope>

  9. SOAP Header • Header is optional. • Contain the attributes of the message, any application-defined information associated with the message. • Can be extended to include additional features and functionalities.

  10. SOAP Header (2) <SOAP-ENV:Header> <t:Transaction xmlsns:t=“www.xmlbus.com” SOAP-ENV:mustUnderstand=“1”> <!-- the receiving node must support Transaction or generate an error code or SOAP fault if it does not --> </t:Transaction> <proc:processed-by> <!-- Information about intermediary processing nodes goes here --> <node> <time-in-millis>1013694680000</time-in-millis> <identity>http://www.doddystore.com/sales</identity> </node> </proc:processed-by> <mi:message-id SOAP-ENV:acor=“http://www.doddystore.com/logger” > <!-- The id element of the message --> 4ryiuyr93247:huh434:f43yr7f:-8000 </mi:message-id> </SOAP-ENV:Header>

  11. SOAP Body • The most important and required part. • Consists of: • The information we want to exchange with web service. • Fault message to send to previous node when an error occur. • Should be processed only by the ultimate receiver.

  12. SOAP Body (2) • Document/Literal centric example <SOAP-ENV:Body> <po:purchaseOrder oderDate=“2006-02-28” xmlns:po=“http://www.doddystore.com/PO”> <po:accountName>amazon.com</po:accountName> <po:accountNumber>8899</po:accountNumber> <po:book> <po:title>CS409 Application Services</po:title> <po:quantity>89</po:quantity> <po:price>24.99</po:price> </po:book> </po:purchaseOrder> </SOAP-ENV:Body>

  13. SOAP Body (3) • RPC/Literal centric example <SOAP-ENV:Envelope xmlns:SOAP-ENV=“http://www.w3.org/2003/05/soap-envelope/” xmlns:mh=“http://www.doddystore.com/BookQuote/” > <SOAP-ENV:Body> <!-- This is a sample request message --> <mh:getBookPrice> <isbn>032111678</isbn> </mh:getBookPrice> <SOAP-ENV:Body> </SOAP-ENV:Envelope> <SOAP-ENV:Envelope xmlns:SOAP-ENV=“http://www.w3.org/2003/05/soap-envelope/” xmlns:mh=“http://www.doddystore.com/BookQuote/” > <SOAP-ENV:Body> <!-- This is a sample response message --> <mh:getBookPriceResponse> <result>24.99</result> </mh:getBookPriceResponse> <SOAP-ENV:Body> </SOAP-ENV:Envelope>

  14. SOAP Body (4) • SOAP fault: • <faultcode>, can be standard code (Client, Server, VersionMismatch, MustUnderstand) or non-standard fault codes. • <faultstring>, explanation about the fault. • <faultactor>, URI identifying the address of SOAP processor generates the fault. • <detail>, application specific information about the fault.

  15. SOAP Body (5) • SOAP fault sample: <SOAP-ENV:Body> <SOAP-ENV:Fault> <faultcode>SOAP-ENV:Client<faultcode> <faultstring>The ISBN code contains an invalid characters</faultstring> <faultactor>http://www.doddystore.com/priceProcessor/</faultactor> <detail> <mh:ISBNFaultDetail> <offending-value>12345</offending-value> <conformance-rules> ISBN cannot contains special characters such as %, &, or #. </conformance-rules> </mh:ISBNFaultDetail> </detail> <SOAP-ENV:Fault> <SOAP-ENV:Body>

  16. Sending Binary Data • How to send large blob binary data with web service? • XML can’t directly encode 8-bit binary data. • Workaround: • Use XML schema type base64binary and encode the data as base64 text inside the XML. • Use SOAP with attachment. • DIME = Direct Internet Message Encapsulation by Microsoft and IBM (not widely supported).

  17. Sending Binary Data (2) • Sample using base64 text: <SOAP-ENV:Envelope xmlns:SOAP-ENV=“http://www.w3.org/2003/05/soap-envelope/” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” > <SOAP-ENV:Body> <submitClaim> <accountNumber>Acct001</accountNumber> <eventType>Accident</eventType> <image imageType=“jpg” xsi:type=“base64binary”> 4f3e9 ... <!-- The rest of encoded image goes here --> </image> </submitClaim> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

  18. Sending Binary Data (3) • Sample using attachment: MIME-Version: 1.0 Content-Type: Multipart/Related; boundary=MIME_boundary; type=text/xml; start="<claim061400a.xml@claiming-it.com>" --MIME_boundary Content-Type: text/xml; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-ID: <claim061400a.xml@claiming-it.com> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Body> <theSignedForm href="cid:claim061400a.tiff@claiming-it.com"/> </SOAP-ENV:Body> </SOAP-ENV:Envelope> --MIME_boundary Content-Type: image/tiff Content-Transfer-Encoding: binary Content-ID: <claim061400a.tiff@claiming-it.com> ...binary TIFF image... --MIME_boundary--

  19. Thank You Doddy Lukito dlukito@infinitechnology.com dlukito@alumni.carnegiemellon.edu

More Related