Presentation is loading. Please wait.

Presentation is loading. Please wait.

Web Services: SOAP. SOAP SOAP ir standarts Web servisu saziņošanas protokols Oriģināli SOAP nozīmēja Simple Object Access Protocol vēlāk arī Service Oriented.

Similar presentations


Presentation on theme: "Web Services: SOAP. SOAP SOAP ir standarts Web servisu saziņošanas protokols Oriģināli SOAP nozīmēja Simple Object Access Protocol vēlāk arī Service Oriented."— Presentation transcript:

1 Web Services: SOAP

2 SOAP SOAP ir standarts Web servisu saziņošanas protokols Oriģināli SOAP nozīmēja Simple Object Access Protocol vēlāk arī Service Oriented Architecture Protocol bet sākot ar versiju 1.2 tas ir vienkārši SOAP

3 Vēsture un versijas SOAP gadā izstrādāja Dave Winer, Don Box, Bob Atkinson un Mohsen Al-Ghosein SOAP 1.1 – W3C ierosinājums 2000.gada maijā J2EE 1.4 standarts SOAP 1.2 – W3C rekomendācija sākot ar 2003.gada jūniju Java EE 5 standarts

4 Kas ir SOAP? SOAP is a communication protocol SOAP is for communication between applications SOAP is a format for sending messages SOAP is designed to communicate via Internet SOAP is platform independent SOAP is language independent SOAP is based on XML SOAP is simple and extensible SOAP allows you to get around firewalls SOAP is developed as a W3C standard

5 Kas SOAP nav? SOAP nav komponentu modelis Tas neaizvietos objektus un komponentus, piemērām EJB, JavaBeans SOAP nav programmēšanas valoda Tas neaizvietos Java valodu SOAP nav risinājums visiem uzdevumiem Tas neaizvietos citas dalītas apstrādes tehnoloģijas, tādās kā, piemērām, RMI

6 Kāpēc SOAP? Izstrādājot lietojumprogrammas ir svarīgi dot iespēju programmām sazināties pa Internetu Viens sazināšanas veids ir RPC (Remote Procedure Call), bet HTTP nav īsti piemērots šīm variantam SOAP bija izveidots, lai nodrošināt iespēju sazināties pa HTTP (kaut gan var tikt izmantots arī cits protokols, piemēram SMTP)

7 SOAP over HTTP, SMTP, and Raw TCP/IP A SOAP XML document instance, which is called a SOAP message, is usually carried as the payload of some other network protocol

8 One-Way versus Request/Response Web services can use One-Way messaging or Request/Response messaging

9 Ko SOAP definē? Message Envelope Encoding Rules RPC Convention Binding with underlying protocols

10 SOAP Message SOAP message is made of SOAP Envelope (in XML) Zero or more attachments Zero or more "underlying protocol" header fields SOAP Envelope is composed of SOAP body Main content of the message Zero or more SOAP header blocks Metadata Data aimed at intermediaries Can also contain application data for ultimate receiver

11 SOAP Message Format

12 SOAP in HTTP Request SenderReceiver HTTP Request HTTP Body XML Syntax SOAP Envelope SOAP Body SOAP Body Block Textual Integer 0x0b66

13 SOAP Message Structure A SOAP message is analogous to an envelope used in traditional postal service A SOAP message is a kind of XML document SOAP has its own XML schema, namespaces, and processing rules

14 SOAP Message Structure A SOAP message may have a single Body element preceded, optionally, by one Header element The Envelope element cannot contain any other children! The Header element contains information about the message: security credentials transaction IDs routing instructions debugging information payment tokens

15 Example: SOAP Header 11d1def534ea:b1c5fa:f3bfb4dcd7:-8000

16 SOAP Namespaces XML namespaces play an important role in SOAP messages Examples of namespace prefixes: PrefixNamespace soap"http://schemas.xmlsoap.org/soap/envelope/" xsi"http://www.w3.org/2001/XMLSchema-instance" xsd"http://www.w3.org/2001/XMLSchema" soapenc"http://schemas.xmlsoap.org/soap/encoding/" wsdl"http://schemas.xmlsoap.org/wsdl/" soapbind"http://schemas.xmlsoap.org/wsdl/soap/" wsi"http://ws-i.org/schemas/conformanceClaim/"

17 Example: SOAP Namespaces 11d1def534ea:b1c5fa:f3bfb4dcd7: ...

18 SOAP Message Path Initial sender creates message Ultimate receiver executes main operation Intermediaries perform additional processing

19 SOAP Nodes The applications along the message path are also called SOAP nodes Example: security node authenticates users and verifies message integrity SOAP message Header blocks are intended to be processed in general by intermediary nodes Initial senderFinal receiverSecurity intermediary

20 Roles and Targeting Header blocks are targeted to node via " role " attribute (URI) Role is either address of a node or role name E.g. this security intermediary (address) E.g. any security intermediary (role name) Example The Body is always targeted to ultimate receiver

21 Roles and Targeting SOAP defines three special roles: none next ultimateReceiver The "mustUnderstand" attribute If set to “true”, the node must know how to process the header If a node doesn't understand a mandatory header block, it must generate a SOAP fault

22 Example: Headers with Roles uuid:093a2da1-q r-ba5d-pqff98fe8j7d T13:20: :00 Åke Jógvan Øyvind

23 Intermediary Node Algorithm Receive message Determine roles played Verify all mandatory blocks targeted to node are understood Process appropriate header blocks Processing possibly produces a fault Remove processed headers Add new headers if necessary Forward message to next node

24 Ultimate Receiver Algorithm Receive message Process appropriate header blocks Processing possibly produces a fault Process all body blocks Processing possibly produces a fault

25 SOAP Messaging Modes SOAP supports four modes of messaging RPC/Literal Document/Literal RPC/Encoded Document/Encoded However, RPC/Encoded and Document/Encoded modes are explicitly prohibited

26 Document/Literal Mode In the Document/Literal mode of messaging, a SOAP Body element contains an XML document fragment A well-formed XML element that contains arbitrary application data (text and other elements) that belongs to some XML schema and namespace

27 Example: Document/Literal Body Amazon.com J2EE Web Services

28 RPC/Literal Mode The RPC/Literal mode of messaging enables SOAP messages to model calls to procedures or method calls with parameters and return values The contents of the Body are always formatted as a struct In many cases is used to expose traditional components (servlet, EJB, RMI) as Web services

29 Example: RPC/Literal public interface BookQuote extends java.rmi.Remote { public float getBookPrice(String ISBN) throws RemoteException, InvalidISBNException; } 24.99

30 SOAP Faults SOAP fault messages are the mechanism by which SOAP applications report errors to nodes earlier in the message path SOAP faults are returned to the receiver's immediate sender only Fault element information items faultcode Client, Server, VersionMismatch, MustUnderstand faultstring faultactor detail

31 Example: SOAP Fault soap:Client The ISBN value contains invalid characters D The first nine characters must be digits. The last character may be a digit or the letter 'X'. Case is not important.

32 SOAP over HTTP SOAP messages sent over HTTP are placed in the payload of an HTTP request or response POST /jwsbook/BookQuote HTTP/1.1 Host: Content-Type: text/xml; charset="utf-8" Content-Length: 295 SOAPAction=""

33 References SOAP Tutorial (W3C Schools) SOAP-1.2 Primer SOAP Version 1.2 W3C Specification Book “J2EE Web Services” by Richard Monson-Haefel Richard-Monson-Haefel/dp/


Download ppt "Web Services: SOAP. SOAP SOAP ir standarts Web servisu saziņošanas protokols Oriģināli SOAP nozīmēja Simple Object Access Protocol vēlāk arī Service Oriented."

Similar presentations


Ads by Google