Скачать презентацию XML Protocols Copyright 2001 Active State Protocol Скачать презентацию XML Protocols Copyright 2001 Active State Protocol

5e84133b13fe86011245af9003fbe2f8.ppt

  • Количество слайдов: 55

XML Protocols Copyright 2001, Active. State XML Protocols Copyright 2001, Active. State

Protocol Definition • “A set of formal rules describing how to transmit data, especially Protocol Definition • “A set of formal rules describing how to transmit data, especially across a network. ” • “High level protocols deal with – data formatting, – Including syntax of messages, – character sets, – sequencing of messages etc. ” http: //foldoc. ic. ac. uk/ Copyright 2001, Active. State

Protocol Background • Protocols build on each other (e. g. ): – XML-RPC (remote Protocol Background • Protocols build on each other (e. g. ): – XML-RPC (remote procedures) builds on – HTTP (web) which builds on – TCP (reliability, connections) which builds on – IP (routing, packets) which builds on – Ethernet (sends bits over wires) Copyright 2001, Active. State

Why XML Protocols? • An XML-based protocol automatically “inherits”: – A large code-base of Why XML Protocols? • An XML-based protocol automatically “inherits”: – A large code-base of XML parsers and other tools – A mechanism for representing structured information – Unicode support Copyright 2001, Active. State

Why So Many XML Protocols? • Different tradeoffs. • Often independently invented. • Some Why So Many XML Protocols? • Different tradeoffs. • Often independently invented. • Some will merge. • Some will fall into disuse. • Welcome to the cutting edge! Copyright 2001, Active. State

Web Services Vision • In the future, we want computers to talk to each Web Services Vision • In the future, we want computers to talk to each other more and more… • about more and more complicated stuff! • Automated purchases, auctions, research etc. Copyright 2001, Active. State

Web Services and Protocols • We are going to have to be able to Web Services and Protocols • We are going to have to be able to create new protocols more quickly than ever before! • XML allows us to create a new data representation vocabulary quickly • “Protocol frameworks” build on XML to do the same thing for protocols. Copyright 2001, Active. State

Protocol Frameworks • XML is a markup language • …but a specific vocabulary like Protocol Frameworks • XML is a markup language • …but a specific vocabulary like XHTML or Vox. ML is also called a markup language • Similarly, SOAP and other protocol frameworks are generic protocols that can be used to build more specific protocols Copyright 2001, Active. State

Comparison Criteria • Good criteria come from this W 3 C web page: http: Comparison Criteria • Good criteria come from this W 3 C web page: http: //www. w 3. org/2000/03/29 -XMLprotocol-matrix Copyright 2001, Active. State

Comparing Sync/Async • Synchronous: sender and receiver are alternately in the “listening” or “sending” Comparing Sync/Async • Synchronous: sender and receiver are alternately in the “listening” or “sending” mode – like a traffic light. • Asynchronous: information can arrive any time – like a corner with no stop sign Copyright 2001, Active. State

Examples • Synchronous: “Web site contacted…waiting for reply. ” • Asynchronous: telephone call. • Examples • Synchronous: “Web site contacted…waiting for reply. ” • Asynchronous: telephone call. • Synchronous: “That will be $5. 00. Here’s your food. ” • Asynchronous: “Alert: Your stock just tanked!” Copyright 2001, Active. State

Comparing Extensibility • Some protocols are problem-domain specific. • Others are meant to be Comparing Extensibility • Some protocols are problem-domain specific. • Others are meant to be the generalized basis of other protocols. • All of them are designed with some “primary domain” in mind: that often explains why they are different. Copyright 2001, Active. State

Comparing Data Typing • If the protocol is intended to be a basis for Comparing Data Typing • If the protocol is intended to be a basis for others: – Are data-types inline or out-of-line? – Can you directly represent arbitrary data structures? • Type definitions are not strictly necessary but they ease the integration of protocols with programming languages and databases Copyright 2001, Active. State

Comparing Associated Schemas • Is there a schema for the protocol interactions themselves? • Comparing Associated Schemas • Is there a schema for the protocol interactions themselves? • Can you refer to a data typing schema? Copyright 2001, Active. State

Comparing Packaging • Explicit support for packaging non-XML information? • You can always embed Comparing Packaging • Explicit support for packaging non-XML information? • You can always embed Base-64 information in XML but that is inefficient. • Some protocols describe how to handle multiple parts and refer between parts using links. Copyright 2001, Active. State

Jabber • Jabber is designed for XML-Based “Instant Messaging” • It’s creators promote it Jabber • Jabber is designed for XML-Based “Instant Messaging” • It’s creators promote it as a basis for all sorts of XML-based messaging. • Any XML namespaces can be used within it! • e. g. Biz. Talk messages embedded in Jabber streams. Copyright 2001, Active. State

Jabber Copyright 2001, Active. State Jabber Copyright 2001, Active. State

Jabber & Instant Messaging • Jabber is in-use today but is not (yet? ) Jabber & Instant Messaging • Jabber is in-use today but is not (yet? ) as popular as proprietary messaging systems. • Jabber’s primary distinguishing characteristic is its open architecture. Copyright 2001, Active. State

Jabber Specs • • • Namespace-based extensibility Defines long-lived XML streams Primarily Async Doesn’t Jabber Specs • • • Namespace-based extensibility Defines long-lived XML streams Primarily Async Doesn’t define any type system Can be used for Remote Procedure Calls (with a little extra code) Copyright 2001, Active. State

Jabber Streams • single, persistent XML stream • running on a single socket <stream: Jabber Streams • single, persistent XML stream • running on a single socket (entire long-lived session is conducted) Copyright 2001, Active. State

Jabber “Identity” • Things in Jabber with identities are known as “entities”: – Users Jabber “Identity” • Things in Jabber with identities are known as “entities”: – Users – Chatrooms – “Proprietary” message systems (ICQ) –… Copyright 2001, Active. State

Testing This is just a test message •" src="https://present5.com/presentation/5e84133b13fe86011245af9003fbe2f8/image-22.jpg" alt="Jabber “Messages” Testing This is just a test message •" /> Jabber “Messages” Testing This is just a test message – subject line • – text of the message (arbitrary XML) • – register a Jabber extension • – error message • – some identifying string Copyright 2001, Active. State

Jabber “Info/Query” • Info/query is a way of doing RPC-like things in Jabber • Jabber “Info/Query” • Info/query is a way of doing RPC-like things in Jabber • You send out an info/query “request” with an “iq” element. • The “iq” element is sent out • If there is a result, it comes back through another “iq” element Copyright 2001, Active. State

Info/Query types • Outgoing: – “get” – get some information – “set” – set Info/Query types • Outgoing: – “get” – get some information – “set” – set a value • Returning: – “result” – a return value – “error” – the query failed Copyright 2001, Active. State

Jabber Extension • Jabber is somewhat informally specified. • If you define a protocol Jabber Extension • Jabber is somewhat informally specified. • If you define a protocol “based on” Jabber, it isn’t clear how you would specify – types, – expected responses, – etc. Copyright 2001, Active. State

Jabber Info • http: //www. jabber. org • http: //www. jabber. com • http: Jabber Info • http: //www. jabber. org • http: //www. jabber. com • http: //protocol. jabber. org Copyright 2001, Active. State

XML-RPC • • Request/response-type (sync) protocol Deployed and in use! The original XML-based RPC XML-RPC • • Request/response-type (sync) protocol Deployed and in use! The original XML-based RPC protocol Still the easiest way to do crosslanguage, cross-platform RPC! Copyright 2001, Active. State

XML-RPC Specs • Based on HTTP • Supports a fixed set of hard-coded types XML-RPC Specs • Based on HTTP • Supports a fixed set of hard-coded types and data structures. • Does not directly support more structured types. Copyright 2001, Active. State

XML-RPC HTTP Header POST /RPC 2 HTTP/1. 0 User-Agent: Some Client Software Host: betty. XML-RPC HTTP Header POST /RPC 2 HTTP/1. 0 User-Agent: Some Client Software Host: betty. userland. com Content-Type: text/xml Content-length: 181 Copyright 2001, Active. State

get. State. Name" src="https://present5.com/presentation/5e84133b13fe86011245af9003fbe2f8/image-30.jpg" alt="Example Message get. State. Name" /> Example Message get. State. Name 41 Copyright 2001, Active. State

method. Call • • There is always one method. Call element. It always contains method. Call • • There is always one method. Call element. It always contains method. Name element. There is typically a params sub-element. The params element always contains one or more param elements. • Each param has a value. • Parameters are not named. Copyright 2001, Active. State

Basic Value Types • <i 4> or <int> – four-byte signed integer (e. g. Basic Value Types • or – four-byte signed integer (e. g. – 12) • – 0 (false) or 1 (true) • – ASCII string (e. g. hello world) • – double-precision signed floating point number (e. g. -12. 214) Copyright 2001, Active. State

More Basic Types • <date. Time. iso 8601> – date/time – (e. g. 19980717 More Basic Types • – date/time – (e. g. 19980717 T 14: 08: 55) • – base 64 -encoded binary – (e. g. e. W 91 IGNhbid 0 IHJl. YWQgd. Ghpcy. E=) Copyright 2001, Active. State

Structures • Structures <struct> <member> <name>lower. Bound</name> <value><i 4>18</i 4></value> </member> <name>upper. Bound</name> <value><i Structures • Structures lower. Bound 18 upper. Bound 139 Copyright 2001, Active. State

Arrays <array> <data> <value><i 4>12</i 4></value> <value><string>Egypt</string></value> <value><boolean>0</boolean></value> <value><i 4>-31</i 4></value> </data></array> Copyright 2001, Arrays 12 Egypt 0 -31 Copyright 2001, Active. State

Extensibility • XML-RPC is extensible in that you can define different method names and Extensibility • XML-RPC is extensible in that you can define different method names and they can have different parameters • New data types and data structures are not supported. • Namespaces are not supported. Copyright 2001, Active. State

SOAP • • • In use (e. g. at Active. State!) Can be used SOAP • • • In use (e. g. at Active. State!) Can be used synchronously or async Type names can be inline or out-of-line Namespace-based extensibility Higher level protocols definable in Web Services Description Language • Types come from W 3 C Schemas Copyright 2001, Active. State

What Does SOAP Define? • Standard expression for – message envelopes – headers – What Does SOAP Define? • Standard expression for – message envelopes – headers – bodies • Standard encoding rules for structured data • RPC mechanism Copyright 2001, Active. State

SOAP Generality • You may – use any XML content as payload. – use SOAP Generality • You may – use any XML content as payload. – use SOAP in a sync RPC model or any other model. – Use SOAP object encoding with or without envelopes and RPC. Copyright 2001, Active. State

Scope • SOAP leaves various issues to other specs: – datatypes (XML schemas) – Scope • SOAP leaves various issues to other specs: – datatypes (XML schemas) – discovery (UDDI) – service description (WSDL) – security (SSL, https, …) Copyright 2001, Active. State

SOAP HTTP Header POST /Stock. Quote HTTP/1. 1 Host: www. stockquoteserver. com Content-Type: text/xml; SOAP HTTP Header POST /Stock. Quote HTTP/1. 1 Host: www. stockquoteserver. com Content-Type: text/xml; charset="utf-8" Content-Length: nnnn SOAPAction: "Some-URI" Copyright 2001, Active. State

SOAP XML Header <SOAP-ENV: Header> <myns: From>Mark. H</myns: From> <myns: To>Dick. H</myns: To> <myns SOAP XML Header Mark. H Dick. H Beer Copyright 2001, Active. State

SOAP Body The SOAP body is syntactically just like the header. <SOAP-ENV: Body> <myns: SOAP Body The SOAP body is syntactically just like the header. Wed, 20 Sep 2000 Mark. H@Active. State. com Copyright 2001, Active. State

SOAP Information Encoding • Header and body entries are arbitrary XML. • XML has SOAP Information Encoding • Header and body entries are arbitrary XML. • XML has no data types or data structures other than “string” and “tree”. • SOAP defines some conventions that allow a few more data structures. Copyright 2001, Active. State

SOAP Types & Structures • “Simple value” – a primitive type • “Compound value” SOAP Types & Structures • “Simple value” – a primitive type • “Compound value” – structured type • “Arrays” – compound values indexed by position • “Structs” – compound values indexed by “role name” • … a little more complicated than it seems… Copyright 2001, Active. State

SOAP Types • SOAP does not define primitive types. • You may use XML SOAP Types • SOAP does not define primitive types. • You may use XML Schema or other. • Elements can be type-declared – “out of line” in a schema or – “inline” using xsi: type attributes Copyright 2001, Active. State

Service Description • Web Service Description Language (WSDL) describes Web Services • With WSDL, Service Description • Web Service Description Language (WSDL) describes Web Services • With WSDL, web service providers can formally describe what services they provide. • WSDL is a sort of “schema for protocols. ” • Somewhat similar to IDL for COM/CORBA Copyright 2001, Active. State

WSDL Deployment • WSDL is not widely deployed yet • In particular, hampered dependence WSDL Deployment • WSDL is not widely deployed yet • In particular, hampered dependence on W 3 C XML Schema Definition Language (XSDL or “XML Schemas”) • WSDL may not be widely deployed until schemas are. Copyright 2001, Active. State

UDDI • UDDI defines – vocabulary for registering organizations according to the services they UDDI • UDDI defines – vocabulary for registering organizations according to the services they provide. – SOAP messages for publishing this information. – SOAP messages for querying repositories. Copyright 2001, Active. State

XP: XML Protocol Activity • “The goal of XML Protocol is to develop technologies XP: XML Protocol Activity • “The goal of XML Protocol is to develop technologies which allow two or more peers to communicate in a distributed environment, using XML as its encapsulation language” • Formally standardizing SOAP Copyright 2001, Active. State

eb. XML Message Service • An extension to SOAP for electronic business – Security eb. XML Message Service • An extension to SOAP for electronic business – Security – reliability Copyright 2001, Active. State

Web. DAV • Not a general-purpose “generic” protocol • Designed specifically for web-based content Web. DAV • Not a general-purpose “generic” protocol • Designed specifically for web-based content management • With Web. DAV, it would be possible to directly “edit” pages on the web (with appropriate permissions) Copyright 2001, Active. State

Biz. Talk • Built on SOAP • Biz. Talk is basically a higher-level protocol Biz. Talk • Built on SOAP • Biz. Talk is basically a higher-level protocol specific to business commerce • Biz. Talk is controlled by Microsoft. • Many see it as a competitor to eb. XML. Copyright 2001, Active. State

Summary • Most new protocols will be based upon XML. • Some, like Web. Summary • Most new protocols will be based upon XML. • Some, like Web. DAV, use XML “directly” • Others build on generic XML Protocol “frameworks” like SOAP and the eb. XML Messaging Service • Either way: XML Protocols are here to stay! Copyright 2001, Active. State

Resources paulp@activestate. com (that’s me!) http: //www. activestate. com/Initiatives/Web Services/index. html http: //www. w Resources paulp@activestate. com (that’s me!) http: //www. activestate. com/Initiatives/Web Services/index. html http: //www. w 3. org/2000/xp/ Copyright 2001, Active. State