REST, Self-description, and XML

For XUGO

Mark Baker

January 15, 2004

Overview

REST

Key REST constraints

Self-descriptive messages

Stateless interaction

Resource identification

Uniform interface

Hypermedia

Self-describing

Self-describing

"Follow your nose"

You have an ethernet cable

... which only takes Ethernet packets.

Ethernet packets have a field

.... which takes a value

... which indicates that the packet conforms to the

Internet protocol

You send an Internet packet

... which has a field which indicates the protocol.

A particular value indicates that that the rest of the packet conforms to...

the Transmission Control Protocol specification

The TCP spec

specifies that a particular field in a a packet is a port number. The significance of this is defined by the

IANA Port Number Registry

IANA Port Number Registry

lets you know that a value of 80 indicate that the TCP byte stream conforms to the

HTTP Protocol Specification

The Hypertext Transfer Protocol (HTTP) specification

specifies that when a response has a code of 200 then the interpretation of the rest of the response is determined by a

MIME type.

The MIME type

is registered in a list with IANA, which specifies that, for example, if the MIME type is application/xml, then the relevant specifications are the

XML and Namespaces specifications

Hold up!

I disagree with Timbl here; you cannot "follow your nose" from application/xml in RFC 3023 to document-specific processing (i.e. no namespace dispatching)

RFC 3023 says;

An XML document labeled as text/xml or application/xml might contain namespace declarations [...] Such a document might be handled by applications that would use this information to dispatch the document for appropriate processing.

"Might". Not "Will"

XML; what's the X stand for again?

How can we fix that?

Can we do that?

Yes!

Cool! What can we call it?

RDF!

the W3C's Resource Description Framework

Comparing RDF/XML & XML

  <Person xmlns="http://example.org/foofoo/">
    <name>Mark Smith</name>
    <age>55</age>
  </Person>

More RDF

  <a:Person xmlns:a="http://example.org/foofoo/"
     a:name="Mark Smith" a:age="55"/>

Semantically identical to previous example

Can also do; collections, provide URI for "Mark Smith", ...

Conclusion

Self-description is HARD ... but IMPORTANT

RDF/XML "extends" XML with self-descriptive processing and extensibility model