1 / 23

SOAP

SOAP. Basic SOAP Message Exchange. WSDL describing service. Service Provider. Service Consumer. DESCRIBE. http transport. SOAP message. client. service. SOAP Sender. SOAP Receiver. INVOKE. http transport. SOAP message. SOAP Receiver. SOAP Sender. registry. find.

amora
Télécharger la présentation

SOAP

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

  2. Basic SOAP Message Exchange WSDL describing service Service Provider Service Consumer DESCRIBE http transport SOAP message client service SOAP Sender SOAP Receiver INVOKE http transport SOAP message SOAP Receiver SOAP Sender registry find Service Broker publish

  3. SOAP Message SOAP envelope SOAP header Header block Header data Header data Header data SOAP Body Body child element Body child element

  4. SOAP Building Blocks • A SOAP message is an XML document with the following elements • A required envelope • Identifies XML document as a SOAP message • An optional header • Contains header information • A required body element with call and response information • An optional fault element • Information about errors that could occur

  5. Sample SOAP Message • <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> • <env:Header> <n:alertcontrol xmlns:n="http://example.org/alertcontrol"> <n:priority>1</n:priority> <n:expires>2001-06-22T14:00:00-05:00</n:expires> </n:alertcontrol> </env:Header> • <env:Body> <m:alert xmlns:m="http://example.org/alert"> <m:msg>Pick up Mary at school at 2pm</m:msg> </m:alert></env:Body> • </env:Envelope>

  6. SOAP Envelope Element • Required field – tells that this XML document is a SOAP message • Encoding style attribute – used to define data types used in the document <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> ... Message information goes here ... </soap:Envelope>

  7. SOAP Header • Contains application specific information (e.g. authentication, payment, etc.) • Optional field, but if present, must be the first child of the envelope element <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <soap:Header> <m:Trans xmlns:m=http://www.w3schools.com/transaction/ soap:mustUnderstand="1">234</m:Trans> </soap:Header>... .. .</soap:Envelope>

  8. SOAP Header – Contd. • The previous example contains • A Trans element, which is an actor • mustUnderstand attribute of 1 • A value of 234, which denotes an encoding style • Actor attribute • Message may pass multiple nodes – we need to denote who needs to act on it • mustUnderstand – whether a header entry is madatory or optional for the recipient to process

  9. SOAP Body • Actual message <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <soap:Body> <m:GetPrice xmlns:m="http://www.w3schools.com/prices"> <m:Item>Apples</m:Item> </m:GetPrice> </soap:Body> </soap:Envelope>

  10. Response <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <soap:Body> <m:GetPriceResponse xmlns:m="http://www.w3schools.com/prices"> <m:Price>1.90</m:Price> </m:GetPriceResponse> </soap:Body> </soap:Envelope>

  11. SOAP Fault Element • Error message from a SOAP message is carried inside a fault element • Must appear as a child element of the body element • Has the following subelements: • Faultcode - identifies the fault • Faultstring – human readable explanation of the fault • Fault-factor – what caused the fault • Details -- application specific information

  12. A More Involved Example seller buyer message broker RFQ seller QuoteResponse Award seller

  13. Conversational SOAP Message Exchange: A Request <?xml version='1.0' ?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> • <env:Header> • <r:RFQNum xmlns:r=“http://bigco.example.org/RFQ” env:mustUnderstand=“true”>101</r:RFQNum> • <r:custNum env:mustUnderstand=“true”>17</r:custNum> • </env:Header> • <env:Body> • <r:RFQ xmlns:r=“http://bigco.example.org/RFQ”> • <r:manufacturer>SanDisk</r:<Manufacturer> • <r:productname>SecureDigital memory</r:productname> • <r:size>1GB</r:size> • <r:substitutable/> • <r:quantity>100</r:quantity> </r:RFQ> • </env:Body> • </env:Envelope>

  14. Conversational Exchange: A Response <?xml version='1.0' ?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> • <env:Header> • <r:RFQNum xmlns:r=“http://bigco.example.org/RFQ”> • env:mustUnderstand=“true”>101</m:RFQNum> • <r:vendorID env:mustUnderstand=“true”>2470</r:vendorID> • <r:bidNum env:mustUnderstand=“true”>1</r:RFQNum> • <r:custNum env:mustUnderstand=“true”>17<r:custNum> • </env:Header> • <env:Body> • <r:quoteRespons xmlns:r=“http://bigco.example.org/RFQ”> • <r:manufacturer>KingMax</r:<Manufacturer> • <r:productName>SecureDigital memory</r:productname> • <r:size>1GB</r:size> • <r:speed>9000KB/s</r:speed> • <r:VendorName URL=“http://memunlim.com”>Memories Unlimited</r:VendorName> • <r:SKU>KM-SD1000</r:SKU> • <r:quantity>100</r:quantity> • </r:quoteResponse> • </env:Body> </env:Envelope>

  15. Conversational Exchange:Completion <?xml version='1.0' ?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <r:vendorID env:mustUnderstand=“true”>2470</r:vendorID> <r:bidNum env:mustUnderstand=“true”>1</r:bidNum> <r:custNum env:mustUnderstand=“true”>17<r:custNum> </env:Header> <env:Body> <r:Award xmlns:r=“http://bigco.example.org/RFQ”> <r:SKU>KM-SD1000</r:SKU> <r:quantity>50</r:quantity> </r:Award> </env:Body> </env:Envelope>

  16. Remote Procedure Calls • To invoke RPC • Address of target SOAP node • Method name • Identities and values of arguments • Separation of arguments identifying target of RPC versus data • Plus values of properties for binding (e.g. GET, POST) • Optional header data

  17. RPC Invocation <?xml version='1.0' ?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Header><t:transaction xmlns:t=“http://shippingservice.org/transaction” env:encodingStyle=“http://shippingservice.org/encoding” env:mustUnderstand=“true”>5</t:transaction> </env:Header> <env:Body> <s:shipOrder xmlns:s=“http://shippingservice.org”> <s:origin env:encodingStyle="http://www.w3.org/2003/05/soap-encoding" > <r:vendorID xmlns:r=“http://bigco.example.org/RFQ”> 2470 </r:vendorID> </s:origin> <s:destination> <r:custNum env:mustUnderstand=“true”>17<r:custNum> </s:destination> <s:weight>500g</s:weight> </s:shipOrder> </env:Body> </env:Envelope>

  18. RPC Result <?xml version='1.0' ?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" ><env:Header><t:transaction xmlns:t=“http://shippingservice.org/transaction” env:encodingStyle=“http://paymentservice.org/encoding” env:mustUnderstand=“true”>5</t:transaction> </env:Header> <env:Body> <s:shipOrderResponse env:encodingStyle=“http://www.w3.org/2003/05/soap-encoding” xmlns:rpc=“http://www.w3.org/2003/05/soap-rpc” xmlns:s=“http://shippingservice.org”> <rpc:result>s:status</rpc:result> <s:status>confirmed</s:status> <s:amount>$20.00</s:amount> </s:shipOrderResponse> </env:Body> </env:Envelope>

  19. SOAP Faults Place faults inside env:Body elements In single env:Fault env:Node identifies node which generated fault Absence indicates “ultimate recipient” env:Code env:Value env:Subcode env:Reason env:Text env:Detail Application specific

  20. SOAP Fault Example <?xml version='1.0' ?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:rpc='http://www.w3.org/2003/05/soap-rpc'> <env:Body> <env:Fault> <env:Code> <env:Value>env:Sender</env:Value> <env:Subcode> <env:Value>rpc:BadArguments</env:Value> </env:Subcode> </env:Code> <env:Reason> <env:Text xml:lang="en-US">Processing error</env:Text> <env:Text xml:lang="cs">Chyba zpracování</env:Text> </env:Reason> <env:Detail> <e:myFaultDetails xmlns:e="http://shippingservice.org/faults"> <e:message>Unknown destination</e:message> <e:errorcode>999</e:errorcode> </e:myFaultDetails> </env:Detail> </env:Fault> </env:Body> </env:Envelope>

  21. SOAP Processing Model • SOAP messages are sent from one sender node passing through zero or more intermediaries • Three roles • next: each SOAP intermediary or end destination must act in this role • none: SOAP nodes must not act in this role • ultimateReceiver: destination acts in this role • Header blocks targeted to specific roles using Role attribute • If mustUnderstand=“true” SOAP receiver must understand or generate SOAP fault • Header blocks processed by intermediaries are generally removed before forwarding • Override with relay attribute • Allows targeting of headers to specific intermediaries (but mustUnderstand would then generally be turned off)

  22. SOAP Processing: Header Blocks, MustUnderstand and Relay <?xml version="1.0" ?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <p:oneBlock xmlns:p="http://example.com" env:role="http://example.com/Log" env:mustUnderstand="true"> ... </p:oneBlock> <q:anotherBlock xmlns:q="http://example.com" env:role="http://www.w3.org/2003/05/soap-envelope/role/next" env:relay="true"> ... ...</q:anotherBlock> <r:aThirdBlock xmlns:r="http://example.com"> ... ... </r:aThirdBlock> </env:Header> <env:Body > ... ... </env:Body> </env:Envelope>

  23. SOAP Remoting Architecture SOAP Remoting Architecture application level Client application code Server object implementation Server skeleton Client stub XML marshaller XML unmarshaller remoting architecture level envelope header header body http protocol http server http server wire protocol level TCP/IP socket

More Related