Tuesday, March 19, 2013

Web-based Services

SOAP - Simple Object Access Protocol

  • Messages are encoded in Xml
  • The format is defined by SOAP
    • Envelope
    • Headers (not the same as HTTP headers)
    • Body - contains the data/payload and an Operation (verb) name that maps to some code method on the Server
  • Several protocols collectively referred to as WS-* protocols (e.g. WSDL, MEX)
  • Uses HTTP POST

POX - Plain Old Xml

  • Transfer of XML data over HTTP
  • XML is application defined. Often an XML Schema is provided
  • HTTP GET to a URI fetches the desired data
    • A client can specify preferred format in the HTTP header to get data in the desired format, such as XML, JSON, or AtomPub (if supported by the Service)
    • Accept: application/json, application/atom+xml
  • HTTP POST to a URI modifies the desired data

REST - REpresentational State Transfer

  • Services are exposed as "resources" (URIs). Example, http://WeatherService.com/USA/CA/SANDIEGO would return the whether for San Diego, California
  • CRUD operations on a resource (URI) are defined by HTTP verbs such POST, GET, PUT, and DELETE, respectively
  • GET to a given URI may retrieve requested data or entity; POST to the same URI may add a new data or entity

Atom

  • A specific dialect of XML
  • Extensible, older clients simply ignore extra data
  • Leverages REST to communicate

Atom+Pub

  • XML format similar to Atom but extended to provide more functionality
  • Builds on Atom by supporting retrieval and editing (publishing) of web resources

OData

  • Extends Atom+Pub to provide RESTful data services for exchanging data over the Web
  • Provides a standard way of editing and querying data
    • Conventions for representing entities in AtomPub
    • Query string conventions for addressing, filtering and paging data
    • Constrained HTTP Operations for submitting requests
    • Metadata support to learn about the service
  • Based on HTTP, AtomPub, JSON
  • Can expose different data sources (db, files,...) uniformly
  • Can use LINQ from .NET client to send OData (RESTful) requests