client WLTM service for RESTful interactions
Application Code Application Code 2
Customer { ID = 2 } Customer { ID = 2 }
XML Client Stack XML Server Stack
BODY = <customer/> BODY = <customer/>
URI = http://service?id=2 URI = http://service?id=2
VERB = POST
STATUS = OK VERB = POST
STATUS = OK
HTTP Client Stack HTTP Server Stack
client service
key points involved here?
1. HTTP as the transport
What’s so great about
2. URI that?indicates
resource 1) Simplicity
3. VERB indicates action
2) Low barrier to entry
4. STATUS CODE3) Standardised
indicates
outcome technologies already
proven on the internet
5. XML as the
payload(s)
ready to build?
before you get to technologies
1) URI scheme for addressing
resources?
2)someone must have (MVC) this
WCF
Can client compose done (REST)
(REST)
LINQ to
XML
additional
ASP.NET WCF
queries? already?
3) XML payload format? JSON
WebClient IIS
as well?
4) client payload format with
Sharing service
clients?
5) Including/linking to related
data?
OData
builds on the RESTful fundamentals
HTTP XML JSON
to provide an open specification for
exposing an abstract data model by adding
URI addressing scheme
payload using AtomPub, Atom and JSON
metadata using the Entity Data Model
batching mechanism for requests
it’s the usual “build or buy” trade-off
standard
• productivity
• existing frameworks/libraries
• tooling support
• existing skillsets
custom • full control
• does what you want and
no more
OData Basics
typed Entry
property
service property
entries need to have a
...
feed primary key
property
link
feed
...
link
all links are URI’s
...
media link BLOB
feed
service must publish a service document
typed Entry
operation JSON listing top level feeds
in AtomPub or ...
...
operation typed Entry
filters
Logic Arithmetic String Date/Time
eq add contains second
ne sub endswith hour
gt mul startswith minute
gteq div length day
lt mod
indexof month
lteq round
insert year
and floor
or ceiling remove x 2
Type
not replace
isof
substring
cast
tolower
toupper
trim
concat
service metadata
an odata service can offer metadata
describing the service
greatly facilitates building clients
service description is represented using
the Entity Data Model (EDM)
fully docmented in the specification
Visual Studio (e.g.) supports this metadata
format via “Add Service Reference”
operations
specification also deals with
INVOKE
GET
DELETE
POST
PUT
client service
client service
maintaining links
including MIME types for ATOM/JSON
maintaining linkshere
including creating links
MERGE also applicable
concurrency checking lists
including partial via ETags
concurrency checkingvia ETags
including protocol versioning
tunnelling over POST
tunnelling over POST
batching
optimise round trips to the server
be more “transactional”
GET /Titles
GET /People
RESPONSE
POST /People(‘Tom Cruise’)
(multipart MIME)
client service
POST
(multipart MIME) $Batch