implementing restful services with windows communication foundation 3 5 sp1
Download
Skip this Video
Download Presentation
Implementing RESTful Services With Windows Communication Foundation 3.5 SP1

Loading in 2 Seconds...

play fullscreen
1 / 22

Implementing RESTful Services With Windows Communication Foundation 3.5 SP1 - PowerPoint PPT Presentation


  • 101 Views
  • Uploaded on

Implementing RESTful Services With Windows Communication Foundation 3.5 SP1. Concepts and Introduction(Part 1 of 2). Session Objectives. Provide you with an overview of REST Understand the REST support of WCF 3.5 Learn how to build an AJAX-Friendly service

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Implementing RESTful Services With Windows Communication Foundation 3.5 SP1' - shelley-hardin


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
implementing restful services with windows communication foundation 3 5 sp1

Implementing RESTful Services With Windows Communication Foundation 3.5 SP1

  • Concepts and Introduction(Part 1 of 2)
session objectives
Session Objectives
  • Provide you with an overview of REST
  • Understand the REST support of WCF 3.5
  • Learn how to build an AJAX-Friendly service
  • Learn how to build a HI-REST service
  • Get you fired up with Demos
agenda
Agenda
  • Why The Web Works
  • What is REST?
  • How REST works in WCF 3.5
  • LO-REST Demo (AJAX)
  • HI-REST Demo (AJAX & Silverlight 2.0)
why the web works
Why The Web Works
  • Simple & Open
    • Addressing scheme – URI
    • Application protocol – HTTP
    • Representation Format - (X)HTML
    • Response Codes – HTTP Status
  • Scales Best When
    • Stateless
    • Cached
  • It works because people find value in it
soap web services
SOAP Web Services
  • HTTP POST of an XML Message (SOAP Envelope)
  • WSDL describes SOAP service
  • WS-* provides extended functionality
  • Standardized and interoperable
  • <s:Envelope>
  • <s:Header>
  • <Action s:mustUnderstand="1">
  • http://t.org/IService1/GetData
  • </Action>
  • </s:Header>
  • <s:Body>
  • <GetData>
  • <value>1</value>
  • </GetData>
  • </s:Body>
  • </s:Envelope>
wcf 3 0 soap http bindings
WCF 3.0 SOAP/HTTP Bindings
  • basicHttpBinding
    • Conforms to WS-I Basic Profile 1.1 standards
    • Compatibile with ASP.NET Web Services (asmx)
  • wsHttpBinding
    • A composable protocol stack allowing standards based additions
      • WS-Security
agenda1
Agenda
  • Why The Web Works
  • What is REST?
  • How REST works in WCF 3.5
  • LO-REST Demo (AJAX)
  • HI-REST Demo (AJAX & Silverlight 2.0)
restful tenents
RESTfulTenents
  • The Web of Services should work the way the Web of Pages works.
  • Simple & Open
  • The Universal API - HTTP
  • Linked Resources
  • Services Scale Best When
    • Stateless
    • Cached
      • Built into the HTTP protocol when leveraged properly
rest continuum
REST Continuum
  • Well Constructed URIs
  • HTTP Verbs
    • GET – Fetch
    • PUT – Update / Insert
    • DELETE – Delete
    • POST – Append
  • Standard Representations

Hi-REST

Lo-REST

RESTfullness

Purists

Pragmatists

  • POST to 1 URI OK
  • Querystrings OK
  • HTTP Verbs
    • GET – Fetch
    • POST - Overloaded
  • AJAX Services
  • POX OK
the microsoft position
The Microsoft Position
  • SOAP is great
  • REST is great
  • Use WCF to build either one and go in peace
agenda2
Agenda
  • Why The Web Works
  • What is REST?
  • How REST works in WCF 3.5
  • LO-REST Demo (AJAX)
  • HI-REST Demo (AJAX & Silverlight 2.0)
webhttpbinding
webHttpBinding
  • New “web-friendly” WCF Binding in Fx 3.5
    • Allows for the development of RESTful services
    • Does not use SOAP envelopes
    • HTTP and HTTPS Transports Only
  • Works across REST Continuum
    • Supports all HTTP verbs
  • Web Message Encoding
    • JSON
    • XML
    • Binary (streams)
webget and webinvoke
[WebGet] and [WebInvoke]
  • Indicate the HTTP Method for the operation
    • WebGet – Don’t make me write it
    • WebInvoke – All verbs other than GET (Method parameter takes in the name of the Verb)
  • Other Parameters
    • BodyStyle – Indicates whether the Request / Response are wrapped or not
    • RequestFormat – Json or Xml
    • ResponseFormat – Json or Xml
    • UriTemplate – Covered next …
uritemplate
UriTemplate
  • String that allows you to define the structure of the URI, as well as to define “Holes”
    • The “Holes” are variables
    • You Bind the template with parameters to fill the holes
  • {productId} hole / variable gets bound to productId parameter in operation

Hole

[OperationContract]

[WebGet(UriTemplate=“product/{productId}")]

ProductGetProduct(intproductId);

webget webinvoke examples
WebGet/WebInvoke Examples

[OperationContract]

[WebInvoke( Method=“PUT",

ResponseFormat=WebMessageFormat.Json,

UriTemplate=“product/{productId}")]

ProductUpdateProduct(intproductId, product p);

[OperationContract]

[WebGet(ResponseFormat=WebMessageFormat.Json,

UriTemplate=“product/{productId}")]

ProductDataGetProduct(intproductId);

webhttpbinding endpoint behaviors
webHttpBinding Endpoint Behaviors
  • Endpoint Behaviors - extend run-time behavior for an endpoint
  • webHttp - enables the Web programming model for a WCF service
  • enableWebScript – ASP.NET AJAX friendly endpoint behavior
      • Aligns nicely with ASP.NET AJAX client
      • SubClasses webHttp
      • Provides ASP.NET AJAX proxy generation
      • Only supports GET and overloaded POST
      • Does not support UriTemplates
slide18

Demo

LO-REST (AJAX Friendly)

slide19

Demo

HI-REST

summary
Summary
  • REST principles borrow from principles of the web
  • Architectures vary with regard to adherence to REST principles
  • webHttpBinding supports architectures across the REST continuum
    • enableWebScript
      • Productivity features for ASP.NET AJAX applications
      • Imposes limitations
    • webHttp – Provides ability to implement services that adhere to strictest of standards
resources
Resources
  • "AJAX Integration and JSON support" in .Net 3.5 conceptual docs
  • "Web Programming Model" in .Net 3.5 conceptual docs
  • Posting of Various Valuable WCF Docs
  • Steve Maine\'s Blog
  • HTTP Programming with WCF and the .NET Framework 3.5 (MSDN Magazine)
  • WCF, WF and .NET 3.5 Whitepapers by David Chappell
ad