55
Copyright 2001, ActiveState XML Protocols

Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Embed Size (px)

Citation preview

Page 1: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

XML Protocols

Page 2: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

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.doc.ic.ac.uk/

Page 3: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

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)

Page 4: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

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

Page 5: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

Why So Many XML Protocols?

• Different tradeoffs.

• Often independently invented.

• Some will merge.

• Some will fall into disuse.

• Welcome to the cutting edge!

Page 6: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

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.

Page 7: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

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.

Page 8: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

Protocol Frameworks

• XML is a markup language

• …but a specific vocabulary like XHTML or VoxML is also called a markup language

• Similarly, SOAP and other protocol frameworks are generic protocols that can be used to build more specific protocols

Page 9: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

Comparison Criteria

• Good criteria come from this W3C web page:

http://www.w3.org/2000/03/29-XML-protocol-matrix

Page 10: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

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

Page 11: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

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!”

Page 12: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

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.

Page 13: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

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

Page 14: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

Comparing Associated Schemas

• Is there a schema for the protocol interactions themselves?

• Can you refer to a data typing schema?

Page 15: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

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.

Page 16: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

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. BizTalk messages embedded in Jabber streams.

Page 17: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

Jabber

Page 18: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

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.

Page 19: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

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)

Page 20: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

Jabber Streams

• single, persistent XML stream• running on a single socket

<stream:stream to="jabber.com" xmlns:stream="http://etherx.jabber.com/streams">

(entire long-lived session is conducted)</stream:stream>

Page 21: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

Jabber “Identity”

• Things in Jabber with identities are known as “entities”:– Users– Chatrooms– “Proprietary” message systems (ICQ)– …

Page 22: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

Jabber “Messages”<message to="[email protected]"><subject>Testing</subject><body>This is just a test message</body></message> • <subject> – subject line• <body> – text of the message (arbitrary

XML)• <x> – register a Jabber extension• <error> – error message• <thread> – some identifying string

Page 23: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

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

Page 24: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

Info/Query types

• Outgoing:– “get” – get some information– “set” – set a value

• Returning:– “result” – a return value– “error” – the query failed

Page 25: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

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.

Page 26: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

Jabber Info

• http://www.jabber.org

• http://www.jabber.com

• http://protocol.jabber.org

Page 27: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

XML-RPC

• Request/response-type (sync) protocol

• Deployed and in use!

• The original XML-based RPC protocol

• Still the easiest way to do cross-language, cross-platform RPC!

Page 28: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

XML-RPC Specs

• Based on HTTP

• Supports a fixed set of hard-coded types and data structures.

• Does not directly support more structured types.

Page 29: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

XML-RPC HTTP Header

POST /RPC2 HTTP/1.0 User-Agent: Some Client SoftwareHost: betty.userland.com Content-Type: text/xml Content-length: 181

Page 30: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

Example Message

<?xml version="1.0"?> <methodCall><methodName>getStateName</

methodName><params><param><value><i4>41</i4></

value></param> </params> </methodCall>

Page 31: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

methodCall

• There is always one methodCall element.

• It always contains methodName 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.

Page 32: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

Basic Value Types

• <i4> or <int>– four-byte signed integer (e.g. –12)

• <boolean>– 0 (false) or 1 (true)

• <string>– ASCII string (e.g. hello world)

• <double>– double-precision signed floating point number

(e.g.-12.214)

Page 33: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

More Basic Types

• <dateTime.iso8601>– date/time– (e.g. 19980717T14:08:55)

• <base64>– base64-encoded binary– (e.g. eW91IGNhbid0IHJlYWQgdGhpcyE=)

Page 34: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

Structures

• Structures<struct><member> <name>lowerBound</name>

<value><i4>18</i4></value></member><member> <name>upperBound</name>

<value><i4>139</i4></value></member></struct>

Page 35: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

Arrays

<array><data><value><i4>12</i4></value><value><string>Egypt</string></value><value><boolean>0</boolean></value><value><i4>-31</i4></value></data></array>

Page 36: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

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.

Page 37: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

SOAP

• In use (e.g. at ActiveState!)

• 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 W3C Schemas

Page 38: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

What Does SOAP Define?

• Standard expression for – message envelopes– headers– bodies

• Standard encoding rules for structured data

• RPC mechanism

Page 39: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

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.

Page 40: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

Scope

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

Page 41: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

SOAP HTTP Header

POST /StockQuote HTTP/1.1Host: www.stockquoteserver.comContent-Type: text/xml; charset="utf-8"Content-Length: nnnnSOAPAction: "Some-URI"

Page 42: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

SOAP XML Header

<SOAP-ENV:Header>

<myns:From>MarkH</myns:From>

<myns:To>DickH</myns:To>

<myns2:Subject>Beer</myns2:Subject>

</SOAP-ENV:Header>

Page 43: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

SOAP Body

The SOAP body is syntactically just like the header.

<SOAP-ENV:Body>

<myns:Date>Wed, 20 Sep 2000</myns: Date>

<myns:From>[email protected]

</myns:From> …

</SOAP-ENV:Body>

Page 44: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

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.

Page 45: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

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…

Page 46: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

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

Page 47: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

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

Page 48: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

WSDL Deployment

• WSDL is not widely deployed yet

• In particular, hampered dependence on W3C XML Schema Definition Language (XSDL or “XML Schemas”)

• WSDL may not be widely deployed until schemas are.

Page 49: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

UDDI

• UDDI defines – vocabulary for registering organizations

according to the services they provide.

– SOAP messages for publishing this information.

– SOAP messages for querying repositories.

Page 50: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

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

Page 51: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

ebXML Message Service

• An extension to SOAP for electronic business– Security– reliability

Page 52: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

WebDAV

• Not a general-purpose “generic” protocol

• Designed specifically for web-based content management

• With WebDAV, it would be possible to directly “edit” pages on the web (with appropriate permissions)

Page 53: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

BizTalk

• Built on SOAP

• BizTalk is basically a higher-level protocol specific to business commerce

• BizTalk is controlled by Microsoft.

• Many see it as a competitor to ebXML.

Page 54: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

Summary

• Most new protocols will be based upon XML.• Some, like WebDAV, use XML “directly”

• Others build on generic XML Protocol “frameworks” like SOAP and the ebXML Messaging Service

• Either way: XML Protocols are here to stay!

Page 55: Copyright 2001, ActiveState XML Protocols. Copyright 2001, ActiveState Protocol Definition A set of formal rules describing how to transmit data, especially

Copyright 2001, ActiveState

Resources

[email protected] (that’s me!)

http://www.activestate.com/Initiatives/WebServices/index.html

http://www.w3.org/2000/xp/