Download
web services and their protocol stack n.
Skip this Video
Loading SlideShow in 5 Seconds..
Web Services and Their Protocol Stack PowerPoint Presentation
Download Presentation
Web Services and Their Protocol Stack

Web Services and Their Protocol Stack

191 Views Download Presentation
Download Presentation

Web Services and Their Protocol Stack

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

  1. Web Services and Their Protocol Stack Juanzi Li Department of Computer Science and Technology Tsinghua University Mar. 2007

  2. Outline • The Model of SOA • Overview of Web Services • XML and XML Schema • The Communication Protocol • Web Services Description • Web Services Flow Description • Web Services Publication and Discovery

  3. The Model of SOA

  4. SOA Model • As a distributed computing architecture, Web Services are the most important implementation for SOA. • SOA Model is Web Services Concept Architecture.

  5. Concept in SOA Model • Role • Services Provider • Services Requestor • Services Registry • Operation • Publish • Find • Bind • Key Component • Services • Services Description

  6. Core Standards in SOA Model • Some Standards • Web Services Description Language (WSDL) • Universal Description, Discovery and Integration (UDDI) • Simple Object Access Protocol (SOAP) • Web Service Flow Language • ……

  7. Process in SOA Development Business Component Analysis Services Identification Services Specification Component Identification Component Specification Services Realization Decision SOA Implementation

  8. The Level Model of SOA Development Business Process Services Consumer Integration Architecture Qos Security Management Services Components Services Provider Existing Application Resources

  9. Process vs Level Model

  10. Relationship Between SOA and Web Services • Based on open standard and flexible implementation, Web services is natively applicable to SOA implementation. • The Relationships between Web services and SOA are: • Web services provide an open standard and machine-readable model (WSDL) for creating explicit, implementation-independent descriptions of service interfaces. • Web services provide communication mechanisms that are location-transparent and interoperable. • Web services are evolving through BPEL4WS, document-style SOAP, and WSDL, and emerging technologies such as WS-ResourceFramework to support the technical implementation of well-designed services that encapsulate and model reusable function in a flexible manner.

  11. Overview of Web Services

  12. Web Services • The Web: Flexible human-machine interaction • Web Services: Web services are a recent set of technology specifications that leverage existing proven open standards such as XML, URL, and HTTP to provide a new system-to-system communication standard. • Working Definition:Network-resident software Services accessible via standardized protocols • Simple Object Access Protocol (SOAP): very flexible remote procedure call • Lots of interest in trade press, academic community, standards bodies, . . . • Applications in e-commerce, telecom, science, GRID, government, education, . . .

  13. Categories of Web Services • Business-Oriented Web Services • ERP,CRM, • Application system integration • Consumer-Oriented Web Services • B2C website, across multi B2C systems • Device-Oriented Web Services • Support the services across different kinds of services. E.g weather report, email service • System-Oriented Web Services • Authentication • Monitoring • QoS

  14. The Processes of Web Services Simplify and/or automate web Services • Discovery • What properties should be described? • How to efficiently query against them? • Composition • Specifying goals of a composition • Specifying constraints on a composition • Building a composition • Analysis of compositions • Invocation • Keeping enactments separated • Providing transactional guarantees • Monitoring • How to track enactments • Recovering from failedenactments

  15. Web Services Standard Stack Web Services composition: WSFL,BPEL4WS WS-CDL WS-CAF Web Services Security: XML-Encryption XML-Signature WS-Security WS-SecureConversation WS-SecurityPolicy WS-Trust Web Services Transaction: WS-Coordination WS-Transaction WS-AtomicTransaction WS-BusinessActivity Web Services Management: WSDM, WS-Manageability SPML, WS-Provisioning Publishing and discovery: UDDI, WSIL , WS-Discovery Services Description Layer: WSDL, WSCL, WSCI,WS-MetadataExchange, WS-Policy XML messaging layer: SOAP , WS-Addressing, WS-Notification, WS-Eventing, WS-Enumeration, WS-MessageDelivery, WS-Reliability,WS Reliable Messaging, WS-Resources WS-Transfer Transport layer: HTTP, SMTP, FTP, etc.

  16. Web Service Core Standards BPEL Behavior WSDL Interface SOAP IBM WebSphere Microsoft .Net Sun J2EE Message XML Schema Type XML Data Implementation Platforms Web Service Standards

  17. XML and XML Schema

  18. The structure of XML • Tag: label for a section of data • Element and Subelement: section of data beginning with <tagname> and ending with matching </tagname> Elements must be properly nested • Proper nesting • <account> … <balance> …. </balance> </account> • Improper nesting • <account> … <balance> …. </account> </balance> • Formally: every start tag must have a unique matching end tag, that is in the context of the same parent element.

  19. The structure of XML • Every document must have a single top-level element <bank> <customer> <name> Hayes </name> <street> Main </street> <city> Harrison </city> <account> <account-number> A-102 </account-number> <branch-name>Perryridge </branch-name> <balance> 400 </balance> </account> <account> … </account> </customer>. . </bank> Top level element

  20. The structure of XML • Attribute • Elements can haveattributes <account acct-type = “checking” > <account-number> A-102 </account-number> <branch-name> Perryridge </branch-name> <balance> 400 </balance> </account> • Attributes are specified by name=value pairs inside the starting tag of an element • An element may have several attributes, but each attribute name can only occur once • <account acct-type = “checking” monthly-fee=“5”>

  21. The structure of XML • Differences between element and attribute attributes cannot be nested <customer name=Hayes street=Main city=Harrison> <account> <account-number> A-102 </account-number> <branch-name> Perryridge </branch-name> <balance> 400 </balance> </account> <account> … </account> </customer>

  22. The structure of XML • Well-Formed XML Documents • There is only one outermost element in the document (called the root element) • Each element contains an opening and a corresponding closing tag • Tags can not overlap, as in <author><name>LeeHong</author></name> • Attributes within an element have unique names • Element and tag names must be permissible

  23. The structure of XML • The Tree Model of XML Documents • There is exactly one root • There are no cycles • Each node, other than the root, has exactly one parent • Each node has a label. Element or attribute • The order of elements is important

  24. Namespace • XML data has to be exchanged between organizations • Same tag name may have different meanings in different organizations, causing confusion on exchanged documents • Specifying a unique string as an element name avoids confusion • Better solution: use unique-name:element-name • Avoid using long unique names all over document by using XML Namespaces

  25. Namespace <Schema name="mySchema" xmlns="urn:schemas-microsoft-com:xml-data" xmlns:dt="urn:schemas-microsoft-com:datatypes" xmlns:myNS=http://www.xml_step_by_step.edu\ns.xml > Three namespaces: schema namespace datatype namespace myNS namespace

  26. XML Schema • Database schemas constrain what information can be stored, and the data types of stored values • schemas are very important for XML data exchange • Otherwise, a site cannot automatically interpret data received from another site • Two mechanisms for specifying XML schema • Document Type Definition (DTD) • XML Schema

  27. XML Schema • XML Schema Supports • Typing of values • E.g. integer, string, etc • Also, constraints on min/max values • User defined types • Is itself specified in XML syntax, unlike DTDs • More standard representation, but verbose • Is integrated with namespaces (reuse and refine) • Many more features • List types, uniqueness and foreign key constraints, inheritance ..

  28. <xsd:schema xmlns:xsd=http://www.w3.org/2001/XMLSchema> <xsd:element name=“bank” type=“BankType”/> <xsd:element name=“account”><xsd:complexType> <xsd:sequence> <xsd:element name=“account-number” type=“xsd:string”/> <xsd:element name=“branch-name” type=“xsd:string”/> <xsd:element name=“balance” type=“xsd:decimal”/> </xsd:squence></xsd:complexType> </xsd:element> ….. definitions of customer and depositor …. <xsd:complexType name=“BankType”><xsd:squence> <xsd:element ref=“account” minOccurs=“0” maxOccurs=“unbounded”/> <xsd:element ref=“customer” minOccurs=“0” maxOccurs=“unbounded”/> <xsd:element ref=“depositor” minOccurs=“0” maxOccurs=“unbounded”/> </xsd:sequence> </xsd:complexType> </xsd:schema>

  29. XML Schema • Element Types <element name=". . ."/> with possible attributes: • ‘ type’ attribute define the element type of this element: type=". . ." (more on types later) • cardinality constraints: • minOccurs="x", where x may be any natural number (including zero) • maxOccurs="x", where x may be any natural number (including zero) or unbounded

  30. XML Schema <element name="email"/> <element name="head" minOccurs="1" maxOccurs="1"/> <element name="to" minOccurs="1"/>

  31. XML Schema • Attribute Types <attribute name=". . ."/> with possible attributes • type=". . ." • use="x", corresponds to #OPTIONAL and #IMPLIED in DTDs • use="x" value=". . .", where x may bedefault or fixed

  32. XML Schema <attribute name="id" type="ID" use="required"/> <attribute name="speaks" type="LanguageType" use="default“ value="en"/>

  33. XML Schema • Data Types • Numerical data types, including integer, Short, Byte, Long, Float,Decimal • String data types, including string, ID, IDREF, CDATA, Language • Date and time data types • user-defined data types • simple data types and complex data types

  34. XML Schema • Complex data type and extension data type • defined from already existing data types by defining some attributes (if any) and using sequence, all and choice. <complexType name="lecturerType"> <sequence> <element name="firstname" type="string" minOccurs="0" maxOccurs="unbounded"/> <element name="lastname" type="string"/> </sequence> <attribute name="title" type="string" use="optional"/> </complexType>

  35. XML Schema • <element name=“lecture” type=“lectureType”> <lecture title=“associate professor”> <firstname>gang</firstname> <lastname>Huang</lastname> </lecture>

  36. XML Schema Data Type Extension: existing data types can be extended by new elements or attributes <complexType name="extendedLecturerType"> <extension base="lecturerType"> <sequence> <element name="email" type="string" minOccurs="0" maxOccurs="1"/> </sequence> <attribute name="rank" type="string" use="required"/> </extension> </complexType>

  37. XML Schema • Restriction data type and simple data type be defined by restricting existing data types <complexType name="restrictedLecturerType"> <restriction base="lecturerType"> <sequence> <element name="firstname" type="string" minOccurs="1" maxOccurs="2"/> </sequence> <attribute name="title" type="string" use="required"/> </restriction> </complexType>

  38. XML schema • Simple data types can also be defined by restricting existing data types. <simpleType name="dayOfMonth"> <restriction base="integer"> <minInclusive value="1"/> <maxInclusive value="31"/> </restriction> </simpleType>

  39. The Communication Protocol(SOAP)

  40. Why Simple Object Access Protocol • SOAP is an XML messaging protocol that is independent of any specific transport protocol. • Light weight replacement for complicated distributed object technology • Originally for BizTalk (Microsoft/UserLand/DevelopMentor) • Now a W3C standard • Based on XML

  41. Envelope contains Header Body Header is optional Out-of-band information such as… Authentication information Message routes Logging Transaction flow Body contains XML body of RPC call SOAP Message Structure SOAP Envelope SOAP Header Header Block . . . Header Block SOAP Body Body Block . . . Body Block

  42. SOAP Example

  43. SOAP Example

  44. Web Services Description Language

  45. Web Services Description Language (WSDL) • WSDL is an XML-based interface definition language that separates function from implementation, and enables design by contract as recommended by SOA. • WSDL defines • What does Services do –interface • Access specification –how • Location of the Services –where

  46. Ingredients of WSDL Supports Interface Port Type Operation How to invoke Input & Output Formats & Protocols Accessspecification Binding Message How to encode Implements Provides Port Services Endpoints

  47. Main Structure of WSDL <definitions namespace = “http://… ”> <types> XML schema types </type> <message> definition of a message </message> <portType> a set of operations </portType> <binding> communication protocols </binding> <Services> a list of binding and ports </Services> </definitions>

  48. Types <types> <schema targetNamespace=“http://example.com/stockquote.xsd” xmlns=“http://www.w3.org/2000/10/XMLSchema”> <element name=“TradePriceRequest”> <complexType> <all> <element name=“tickerSymbol” type=“string“ minOccur = “1” maxOccur=“10”/> <element name = “payment”> <complexType> <choice> <element name = “account” type=“string” /> <element name = “creditcard” type=“string” /> </choice> </complexType> </element> </all> </complexType> </element> </schema> </types> • <types> define data types used in defining messages • XML Schema, DTD, and etc. • XML Schema must be supported by any vendor of WSDL conformant products

  49. WSDL Messages • A <message> element defines the data elements of an operation • Each message can be the input or output of an operation, and may consist of one or more parts • A part resembles a parameter of a function <message name=“GetLastTradePriceInput”> <part name=“body” element="TradePriceRequest"/> </message> <message name=“GetLastTradePriceOutput”> <part name=“body” element=“TradePrice” /> </message>