RSS. ATOM. JSON. POX. REST. WS-*. What are all these terms, and how do they impact the daily life of a developer trying to navigate today's programmable Web? Join us as we explore how to consume and create Web services using a variety of different formats and protocols. Using popular services (Flickr, GData, and Amazon S3) as case studies, we look at what it takes to program against these services using the Microsoft platform today and how that will change in the future.
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
Navigating the Programmable Web
1.
2. Don Box and Steve Maine
URI Jockeys
Microsoft Corporation
3. Goals
How do my programs use the web?
How do my programs become part of the web?
How do I do this efficiently and pragmatically?
Bits
Stuff that's already shipped (lots)
Stuff that will ship in Orcas (lots more)
Stuff that will ship in TBD (a couple of things)
4. GET is More
It’s the URI, Stupid Important Than Formats Matter
You Think
5. The web pivots on URIs
Easy to write down, share, and compare
Hierarchy matches many information models
Can be treated as opaque identifier (a la a GUID)
Can be treated as a structured expression (a la S-Expr)
URI-space for a given service often infinite
May also be state/data dependent
Commonplace to use template syntax to specify quot;holesquot; in
URI space (a la A9 and Joe Gregorio)
6. System.UriTemplate (quot;Orcasquot;) provides runtime support
for URI template syntax
UriTemplate.Bind fills in template holes with actual values
UriTemplate.Match extracts actuals from concrete URI
UriTemplateTable provides matching over multiple
candidate templates
Most specific match wins
7. Uri baseAddress = new Uri( “http://localhost:81” );
string artist = quot;Led Zeppelinquot;;
string album = quot;Fourquot;;
UriTemplate template =
new UriTemplate(“music/{artist}/{album}?format={format}quot; );
Uri boundUri = template.BindByPosition( baseAddress, artist, album, quot;rssquot; );
//boundUri:
// http://localhost:81/music/Led%20Zeppelin/Four?format=rss
UriTemplateMatch match = template.Match( baseAddress, boundUri );
Debug.Assert( match.BoundVariables[“artist”] == artist );
Debug.Assert( match.BoundVariables[“album”] == album );
Debug.Assert( match.BoundVariables[“format”] == “rss” );
11. Degree of Resultant Apocalypse
Dogs/cats sleeping
together; mass hysteria
The Simpsons Movie
Lindsay Lohan
Rectal Itching
The Oprah Channel
Smooth Jazz
Turn off Turn off PUT Turn off POST Turn off GET
DELETE
12. [WebGet] (quot;orcasquot;) adds GET support to WCF service
operations
Allows target URI space to be specified as URI template
Templates parameters mapped to method parameters
WebOperationContext provides easy access to web specifics
(e.g., headers, status codes)
[WebInvoke] provides same for other HTTP methods
POST is default method
13. [WebGet]/[WebInvoke] work great for quot;transparentquot; URI
with well-understood structure
Ideal for server, OK (at best) for client
WebHttpClient (quot;experimentalquot;) is a more flexible client-
side programming model
Supports both transparent and opaque URI
Easier to use and more scalable than current WebClient API
15. Uniform operations are half the web quot;reachquot; proposition
Uniform formats for HTTP entity bodies are the other half
HTML was the ubiquitous format for projecting UX
Alas, multiple format(s) for exchanging data
Original vision for quot;web dataquot; based on plain old XML (POX)
JSON offers simpler format/data model
RSS/ATOM constrain POX by adding list structure
SOAP constraints POX by adding header processing model
16. WebGet/WebInvoke supports XML, JSON, or opaque
binary formats for request/response data
SOAP and POX were in the box in V1
SyndicationFeed/SyndicationItem provide rich
programming model for dealing with RSS/ATOM data
Usable standalone or as WCF message content
Integrates with serialization stacks for feed/item extensibility