Internet protocalls & WCF/DReAM


Published on

My deck from the August presentations at LA C# & SoCal .NET user group meetings

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Internet protocalls & WCF/DReAM

  1. 1. RSS, ATOM, JSON, SOAP, RESTWTF?<br />Woody Pewitt<br />Product Manager<br />MindTouch<br /><br />
  2. 2. What is the alphabet soup?<br />RSS<br />Really Simple Syndication<br />ATOM<br />The Atom Syndication Format<br />JSON<br />JavaScript Object Notation<br />SOAP<br />Simple Object Access Protocol<br />REST<br />Representational State Transfer<br />
  3. 3. “Services”<br />Windows<br />Lunix<br />Mainframe<br />HTTP<br />XML<br />RSS<br />SOAP<br />
  4. 4. Proxy Objects<br />
  5. 5. Really Simple Syndication<br />
  6. 6. Really Simple Syndication (RSS) Feeds<br />Format that is used to publish frequently updated information on the Web<br />e.g. blog entries<br />specific channels on news sites<br />...<br />No single standard<br />RSS 0.91, RSS 1.0 and RSS 2.0<br />RSS feeds are represented as XML documents<br />
  7. 7. RSS Example<br /><?xmlversion="1.0"encoding="iso-8859-1" ?><br /><rssversion="2.0"><br /> <channel><br /> <title>W3Schools Home Page</title><br /> <link></link><br /> <description>Free web building tutorials</description><br /> <item><br /> <title>RSS Tutorial</title><br /> <link></link><br /> <description>New RSS tutorial on W3Schools</description><br /> </item><br /> <item><br /> <title>XML Tutorial</title><br /> <link></link><br /> <description>New XML tutorial on W3Schools</description><br /> </item><br /> ...<br /> </channel><br /> ...<br /></rss><br />many other elements<br /><language>, <copyright>, <pubDate>, ...<br />
  8. 8. ATOM<br />
  9. 9. ATOM<br />Two related standards<br />Atom Syndication Format<br />similar to RSS<br />supports more content formats (e.g. videos) than RSS<br />Atom Publishing Protocol (APP)<br />HTTP-based approach for creating and editing Web resources<br />similar to the RESTful web service example shown earlier <br />
  10. 10. JavaScript Object Notation<br />
  11. 11. JavaScript Object Notation (JSON)<br />Developed as an XML alternative to represent JavaScript objects as strings<br />Easy to produce and faster to parse than XML<br />supports different data types<br />JSON is based on a subset of JavaScript<br />JSON document can be read via the JavaScript eval() function<br />security issues: note that this approach can be dangerous if the source is not trusted since any JavaScript code might be executed<br />most recent browsers offer a JSON parser<br />recognisesonly JSON data types and rejects any scripts<br />Many Web 2.0 Applications offer a JSON interface<br />Flickr, YouTube, Delicious, ...<br />
  12. 12. JSON Data Types<br />
  13. 13. JSON Example<br />{<br /> "surname": "Signer",<br /> “forename": "Beat",<br /> "address": {<br /> "street": "Pleinlaan 2",<br /> "city": "Brussels",<br /> "postalCode": "1050",<br /> "country": "Belgium"<br /> },<br /> "phoneNumbers": [<br /> { "type": "office", "number": "123 456 789" },<br /> { "type": "fax", "number": "987 654 321" }<br /> ]<br />}<br />
  14. 14. JSON-RPC<br />Simple JSON-encoded remote procedure call protocol that is very similar to XML-RPC<br />{<br />"version": "1.1", <br />"method": "Math.multiply", <br />"id": "24034824", <br />"params": [128.0, 256.0]<br />}<br />{<br />"version": "1.1", <br />"result": 32768.0, <br />"error": null, <br />"id": "24034824"<br />}<br />JSON-RPC Request<br />JSON-RPC Response<br />
  15. 15. Web Services<br />Web-based client-server communication over HTTP<br />Two main types of Web Services<br />Big Web Services<br />Universal Description, Discovery and Integration (UDDI)<br />Web Services Description Language (WSDL)<br />Simple Object Access Protocol (SOAP)<br />RESTful Web Services<br />Better integrated with HTTP and web browsers<br />Making use of PUT, GET and DELETE HTTP methods<br />
  16. 16. Big Web Services<br />
  17. 17. Big Web Services<br />Universal Description, Discovery and Integration (UDDI)<br />yellow pages for WSDL<br />"global" registry describing available business services<br />very complex<br />Microsoft and IBM shut down their public UDDI registries in 2006<br />Web Service Description Language (WSDL)<br />XML application to describe a Web Service's functionality complex<br />Simple Object Access Protocol (SOAP)<br />defines an envelope for transporting XML messages<br />The Web Service Stack contains many other protocols<br />BPEL, WS-Security, WS-Reliability, WS-Transaction, ...<br />
  18. 18. SOAP<br />
  19. 19. SOAP<br />Successor of XML-RPC<br />Introduced in 1998 as Simple Object Access Protocol<br />Dave Winer, Don Box, Bob Atkinson and Mohsen Al-Ghosein<br />since version 1.2 the name is no longer treated as an acronym<br />XML-based communication protocol<br />A SOAP message consists of an Envelope element which contains<br />an optional <Header> element<br />a <Body> element<br />remote procedure call or response information<br />SOAP requests are often sent via HTTP POST Request<br />
  20. 20. SOAP<br />WS-* services<br />Common in the enterprise<br />Transport neutral<br />XML<br />SOAP (Meta-data)<br />Security, Transactions, Etc.<br />Typically implemented with RPC-based toolkits, feels a lot like COM+<br />
  21. 21. SOAP Message<br /><?xml version="1.0"?><br /><soap:Header><br /><…></…><br /></soap:Header><br /><soap:Envelope><br /><soap:Body><br /><m:GetStockPrice><br /> <m:StockName>MSFT</m:StockName><br /></m:GetStockPrice><br /></soap:Body><br /></soap:Envelope><br />
  22. 22. SOAP<br />Advantages<br />platform and language independent<br />SOAP over HTTP results in less problems with proxies and firewalls than other remote procedure call solutions<br />There exist a lot of tools and language bindings that automatically create the required client and server-side functionality<br />e.g. Java API for XML Web Services, ASMX, WCF<br />Disadvantages<br />slower than non-verbose protocols<br />Big Web Services are not simple<br />HTTP is reduced to a simple transport protocol for a large amount of XML metadata payload<br />does not make use of the rich functionality offered for HTTP envelopes<br />No mechanism for the caching of results<br />
  23. 23. Representational State Transfer<br />
  24. 24. Representational State Transfer (REST)<br />A REST-style architecture has to conform to the following constraints<br />Separation of concerns between client and server<br />Client and server can be developed and replaced independently<br />Uniform interface<br />identificationof resources (e.g. URIs on the Web)<br />manipulationof resources on the server via representation on the client side<br />self-describing messages (e.g. MIME type on the Web)<br />hypermediafor application state (e.g. hypertext links for related resources)<br />Stateless<br />No client state is stored on the server side<br />Cacheability<br />Responses must explicitly or implicitly define if they are cacheable or not<br />Layering<br />Intermediary servers (proxies) can be transparently added between the client and the server<br />code on demand (optional)<br />The server can send application logic (code) to the client (e.g. Java Applets)<br />A service that conforms at least to the first five constraints is called a RESTful service<br />
  25. 25. REST<br />Common in public facing services<br />Embraces HTTP<br />Services are modeled as “resources” with unique identifiers (URI’s)<br />HTTP defines a uniform service contract: GET, POST, DELETE, HEAD<br />Resources can be represented as XML, RSS, JSON, etc.<br />HTTP provides the necessary features and scalability<br />A successful design pattern used throughout the web today<br />
  26. 26. RESTful Service<br />create or update order #123<br />PUT<br />REST Service<br />retrieve order #123<br />GET<br />Order #123<br />delete order #123<br />DELETE<br />
  27. 27. RESTful Web Service Example<br />POST /users HTTP/1.1<br />Host:<br />Content-Type: application/xml<br /><?xml version="1.0"?><br /><user><br /><name>Kleinermann</name><br /></user><br />GET /users/Kleinermann HTTP/1.1<br />Host:<br />Accept: application/xml<br />PUT /users/Kleinermann HTTP/1.1<br />Host:<br />Content-Type: application/xml<br /><?xml version="1.0"?><br /><user><br /><name>Signer</name><br /></user><br />DELETE /users/Signer HTTP/1.1<br />Host:<br />Accept: application/xm<br />create<br />read<br />update<br />delete<br />
  28. 28. How Did We Get Here?<br />Libraries<br />Pascal binary API<br />COM<br />DCOM<br />APIs talk<br />
  29. 29. Service-orientation<br />In computing, service-orientation is a design paradigm that specifies the creation of automation logic in the form of services. It is applied as a strategic goal in developing a service-oriented architecture (SOA). Like other design paradigms, service-orientation provides a means of achieving a separation of concerns.<br /><br />
  30. 30. Microsoft’s First XML SOA Tools<br />ASP.NET Web Services (ASMX)<br />Basic XML Over HTTP (SOAP 1.1/1.2)<br />WEB Services Enhancements (WSE)<br />Support for WS-Security & TCP services<br />
  31. 31. Windows Communication Framework<br />Abstract or Model<br />Transport<br />Message format<br />Message protocols<br />Extensibility<br />Tries to unify all past models and allows for future changes<br />
  32. 32. How to do WCF?<br />Define your data (.NET class)<br />Define service interface (.NET interface)<br />Add WCF attributes<br />Implement service interface (.NET class)<br />Configure endpoints to expose service (.config files)<br />
  33. 33. Endpoints?<br />Endpoint<br />Address<br />Where to send messages<br />Binding<br />How to send messages<br />Contract<br />What messages must contain<br />
  34. 34. How to consume?<br />WCF on the client uses channels to talk to an endpoint<br />Service<br />(waits for messages)<br />Client<br />Channel<br />endpoint<br />endpoint<br />endpoint<br />endpoint<br />endpoint<br />Metadata<br />endpoint<br />endpoint<br />Metadataimport tool<br />
  35. 35. Why use WCF?<br />Developer Productivity<br />Use the same way to communicate all the time<br />Interoperability<br />Flexibility<br />
  36. 36. An Alternative to WCF<br />MindTouch DReAM<br />MindTouch DReAM(Distributed REST Application Manager) is a Web-Oriented Architecture Framework (WOAF) for developing lightweight, highly decoupled web-services.  The framework includes of a REST microserver and classes for web communication, XML processing, and writing highly asynchronous code.<br />Microsoft .NET and Novell Mono<br /><br />