2Agenda What is REST? How does REST relate to SOAP? REST & SOAPAgendaWhat is REST?How does REST relate to SOAP?Can SOAP & REST be combined?
3REST & SOAPHow did we get here?RESTHTMLSOAPOO/RPC?
4REST == Representational State Transfer REST & SOAPREST is an architectural style, not a standard"Representational State Transfer is intended to evoke an image of how a well-designed Web application behaves: a network of web pages (a virtual state-machine), where the user progresses through an application by selecting links (state transitions), resulting in the next page (representing the next state of the application) being transferred to the user and rendered for their use." - Dr. Roy T. FieldingREST emphasizesScalability of component interactionsGenerality of interfacesIndependent deployment of componentsSupport for intermediaries
5Key Principles of REST "Identification of resources" REST & SOAPKey Principles of REST"Identification of resources"Resources are anything that can be namedNaming authority assigns an identifier to a resource"Manipulation of resources through representations"Representations capture current/intended state of resourcesRepresentations are transferred between componentsRepresentations often contain links to related resources"Self-descriptive messages"Resource identifiers, representation data formats, control data"Hypermedia as the engine of application state"Servers are stateless, messages are independentClients maintain state (representations) & traverse linksInduces scalability, generality, evolvability, extensiblity
9SOAP from a REST viewpoint: Addressing REST & SOAPSOAP from a REST viewpoint: AddressingREST architectures utilize the existing web addressing modelStandardized URI schemes subsume protocols (http, ftp, etc.)Standardized distributed naming authorities (DNS)Standardized way of discovering, referring to resources (URIs)SOAP applications define their own addressing schemesWeb service entrypoints have URIsResources have custom, service-specific addressesNo standardized way of discovering, referring to resourcesIssuesIntermediaries (proxies, caching) cannot operate solely on URISimple URI-based technologies (XSLT, XInclude) hamperedIntegrating disparate applications requires custom logic"Deep linking" into applications not generally possible
10SOAP from a REST viewpoint: Generic Interfaces REST & SOAPREST emphasizes standardized, generic operationsTechnique widely used (SQL, file system, registry, Hailstorm)HTTP provides CRUD-like PUT, GET, POST, DELETEAllows for uniform manipulation of URI-identified resourcesSOAP does not provide for generic operationsEach application defines it's own set of operationsCreates need for description, discovery mechanismsKnowledge of semantics of operation is out-of-bandIssuesClients need knowledge of description, discovery mechanismsClients need foreknowledge of specific service semanticsGeneric clients not universally feasible (local standardization)"Deep linking" into applications not generally possible
11SOAP from a REST viewpoint: State Management REST & SOAPREST applications have explicit state transitionsServers & intermediaries are inherently statelessResources contain data, links to valid state transitionsClients maintain state, traverse links in generic mannerSOAP applications have implicit state transitionsServers & intermediaries may (should!) be statelessMessages contain only data (not valid state transitions)Clients maintain state, require knowledge of state machineIssuesClients need foreknowledge of service's state machineGeneric clients not universally feasible (local standardization)Limits independent evolution of client/server state machineState machine description needed for automated discovery
14REST from a SOAP viewpoint: Counterpoint REST & SOAPREST from a SOAP viewpoint: CounterpointSOAP & related technologies have broad industry supportWhile HTTP is entrenched, WS hype machine is at fever pitchSOAP client & server toolkits are widely deployedTool support on client & server mattersSOAP headers provide a widely adopted extensibility modelDespite presence of HTTP extension mechanismsWS specifications provide end-to-end protocols/featuresHTTP/REST only provides point-to-point solutionsSOAP can be bound to other, non-HTTP transportsImportant for richer XML messaging in the futureSOAP 1.2 can be used in a RESTful manner"Can't we all just get along?"
15RESTful SOAP 1.2 Guidelines REST & SOAPRESTful SOAP 1.2 GuidelinesModel your system as a set of resourcesConsider both concrete & conceptual resourcesAssign logical URIs to resourcesNouns, not verbs; Model whole/part relationshipsDefine schemas for resource representationsPlan for future evolution in schema & instance documentsUse WXS for interoperability & reuse in WSDL definitionsEnable discoverability of resourcesRepresentations include links to contained & related resourcesProvide appropriate resource manipulation operationsGET for idempotent operations (read)POST for state-modifying operations (create/update/delete/etc)Consider using a combination of POST & GET for queries
18Issues Client & Server toolkits REST & SOAPIssuesClient & Server toolkitsSupport for SOAP 1.2 & SOAP Response MEPLarge-scale URI-based message dispatchDynamic modification of client proxy URIsWSDL issuesSOAP 1.2 supportTyped service references (R085)HTTP GET-in/SOAP-out (a-la <http:urlReplacement/>)TradeoffsSOAP extensibility modelEnd-to-end propertiesAlternate protocol bindings
19In a web services world, what matters most: REST & SOAPSummaryREST describes the current Web architectureSOAP enjoys broad industry support, extensibilityClassic SOAP has some limitations compared to RESTREST principles can be applied to XML Web ServicesCombining SOAP 1.2 and REST is both possible & powerfulUnfortunately, there are still lots of issues to be resolvedIn a web services world, what matters most:Web or Services?
20REST & SOAPResourcesRoy T. Fielding: Architectural Styles and the Design of Network-based Software ArchitecturesPaul Prescod: REST resourcesSam Ruby: REST + SOAPRoger Costello: REST TutorialW3C: Architectural Principles of the WWW WD, SOAP 1.2 WDMailing lists: rest-discuss, rest-explore, www-tag, www-ws-desc, xml-dist-app, soapbuildersWeb sites: RESTwiki, Xml.comBloggers: Paul Prescod, Mark Baker, Sam Ruby