navigating the programmable web

22

Upload: goodfriday

Post on 08-May-2015

411 views

Category:

Technology


2 download

DESCRIPTION

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.

TRANSCRIPT

Page 1: Navigating the Programmable Web
Page 2: Navigating the Programmable Web

Navigating the Programmable Web

Don Box and Steve MaineURI JockeysMicrosoft Corporation

Page 3: Navigating the Programmable Web

About This Talk…Goals and Bits

GoalsHow do my programs use the web?How do my programs become part of the web?How do I do this efficiently and pragmatically?

BitsStuff that's already shipped (lots)Stuff that will ship in Orcas (lots more)Stuff that will ship in TBD (a couple of things)

Page 4: Navigating the Programmable Web

About The Web…Stating the Obvious

GET is More Important Than

You Think

It’s the URI, Stupid

Formats Matter

Page 5: Navigating the Programmable Web

It's The URI, StupidQuery, S-Expression, or Opaque Identifier

The web pivots on URIsEasy to write down, share, and compareHierarchy matches many information modelsCan 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 infiniteMay also be state/data dependentCommonplace to use template syntax to specify "holes" in URI space (a la A9 and Joe Gregorio)

Page 6: Navigating the Programmable Web

It's The URI, Stupid,UriTemplates: Embrace Infinity

System.UriTemplate ("Orcas") provides runtime support for URI template syntaxUriTemplate.Bind fills in template holes with actual valuesUriTemplate.Match extracts actuals from concrete URIUriTemplateTable provides matching over multiple candidate templates

Most specific match wins

Page 7: Navigating the Programmable Web

It's The URI, Stupid,UriTemplates

Uri baseAddress = new Uri( “http://localhost:81” );string artist = "Led Zeppelin";string album = "Four"; UriTemplate template = new UriTemplate(“music/{artist}/{album}?format={format}" );

Uri boundUri = template.BindByPosition( baseAddress, artist, album, "rss" ); //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” );

Page 8: Navigating the Programmable Web

Using URIs and UriTemplates

demo

Watch Steve Code…

Page 9: Navigating the Programmable Web

GET is More Important Than You ThinkView It vs. Do It

GET CHAOS

Bounded SemanticsMeans “retrieve”No “unsafe” side-effectsExpectation of idempotency

Unbounded SemanticsMeans “do something”

Side-effects allowedNo expectation of idempotency

Most of the world is GETThe rest is relative chaos

Page 10: Navigating the Programmable Web

GET is More Important Than You ThinkView It vs. Do It

GET CHAOS

“Add”, “Create”, or “Invoke”?

POST PUT DELETE OTHER

“Replace” or “Partial

Update”?

“Delete” or “Rollback”?

What aboutSUBSCRIBE

NOTIFYUPSERT

ENQUEUEMKCOL

Page 11: Navigating the Programmable Web

GET is More Important Than You ThinkView It vs. Do It

Turn off DELETE

Turn off PUT Turn off POST

Turn off GET

Degree of Resultant Apocalypse

Rectal Itching

The Simpsons Movie

Dogs/cats sleepingtogether; mass hysteria

The Oprah Channel

Lindsay Lohan

Smooth Jazz

Page 12: Navigating the Programmable Web

GET is More Important Than You ThinkWebGet/WebInvoke

[WebGet] ("orcas") adds GET support to WCF service operations

Allows target URI space to be specified as URI templateTemplates parameters mapped to method parametersWebOperationContext provides easy access to web specifics (e.g., headers, status codes)

[WebInvoke] provides same for other HTTP methods

POST is default method

Page 13: Navigating the Programmable Web

GET is More Important Than You ThinkWebHttpClient : The Opaque/Transparent Duality

[WebGet]/[WebInvoke] work great for "transparent" URI with well-understood structure

Ideal for server, OK (at best) for client

WebHttpClient ("experimental") is a more flexible client-side programming model

Supports both transparent and opaque URIEasier to use and more scalable than current WebClient API

Page 14: Navigating the Programmable Web

Using WebGet and WebHttpClient

demo

Watch Steve Code…

Page 15: Navigating the Programmable Web

Formats MatterSchemas, Schemas and more Schemas

Uniform operations are half the web "reach" propositionUniform formats for HTTP entity bodies are the other halfHTML was the ubiquitous format for projecting UXAlas, multiple format(s) for exchanging data

Original vision for "web data" based on plain old XML (POX)JSON offers simpler format/data modelRSS/ATOM constrain POX by adding list structureSOAP constraints POX by adding header processing model

Page 16: Navigating the Programmable Web

Formats MatterWCF and Formats

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 contentIntegrates with serialization stacks for feed/item extensibility

Page 17: Navigating the Programmable Web

Fun with Formats

demo

Watch Steve Code…

Page 18: Navigating the Programmable Web

Stuff We UsedThe Code/Time Continuum

Already Shipped

System.UriWebClient

WPFWCF

Ships in “Orcas”

UriTemplate[WebGet]

SyndicationFeedLINQ for XML

JSON Formatter

Speculative Bits

WebHttpClient

Page 19: Navigating the Programmable Web

"Orcas" and the WebCode and Ideas

GET is More Important Than

You Think

It’s the URI, Stupid

Formats Matter

UriTemplate

[WebGet]

SyndicationFeed

LINQ for XML

JSON Formatter

Page 20: Navigating the Programmable Web

Talk amongst ourselves

discussion

Page 21: Navigating the Programmable Web

Please fill out your eval

evaluation

Page 22: Navigating the Programmable Web

© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions,

it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.