SlideShare a Scribd company logo
1 of 26
There is time for REST WCF REST Services
Overview What is REST Rules and Guidelines Hosting a REST Service in .NET Consuming a REST Service with .NET Samples Discussion
What is REST? Roy Fieldinghttp://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm ,[object Object]
Stateless
Cachable
Layered System,[object Object]
HTTP Methods
HTTP Methods
HTTP Status Codes
HTTP Messages Request GET http://localhost:1128/api?$skip=2&$top=2 HTTP/1.1 User-Agent: Fiddler Host: localhost:1128 Accept: application/xml Response HTTP/1.1 200 OK Cache-Control: private Content-Length: 157 Content-Type: application/xml; charset=utf-8 Server: Microsoft-IIS/7.5 Date: Fri, 26 Aug 2011 18:51:22 GMT <?xml version="1.0" encoding="utf-8"?> <Data />
URIs RPC (SOAP) Interface http://example.com/CarsService/getYears http://example.com/CarsService/getMakes http://example.com/CarsService/getAutomobile http://example.com/CarsService/updateAutomobile http://example.com/CarsService/deleteAutomobile
URIs RESTful Interface No need to distinguish get/update/delete, that’s what the HTTP Method is for Collection http://example.com/2011/Honda/ Resource http://example.com/2011/Honda/Civic/2.0
Return Types XML XHTML ATOM Publishing Protocol RSS Custom (should contain hyperlinks) JSON Custom
WCF and REST WCF 4 REST REST endpoints Uri templates for routing WCF Hosting (Console, IIS, etc) etc.
WCF 4 REST, Web Api Programming model for HTTP in WCF Access HTTP from top to bottom REST endpoints Uri templates for routing WCF Hosting (Console, IIS, etc) etc. Http Client Plug in any format / media type Typeless JSON support IQueryablesupport
WCF REST contract [ServiceContract] publicinterfaceIAutomobileService {    [OperationContract]    [WebGet(UriTemplate = "*")] Message Get();    [OperationContract]    [WebInvoke(Method = "PUT", UriTemplate = "*")] Message Put(Message data); }
Uri Templates [ServiceContract] public interface IAutomobileService {    [OperationContract]    [WebGet(UriTemplate = "/{year}/{make}/{model}/{engine}")] AutomobilesGetAutomobiles(string year, string make,  string model, string engine); }
Routing staticvoidRegisterRoutes(RouteCollection routes) { routes.MapServiceRoute<SampleResource>("api"); } voidApplication_Start(objectsender,EventArgs e) { RegisterRoutes(RouteTable.Routes); }
Consuming REST .NET
WebRequest varhttpRequest = (HttpWebRequest)WebRequest.Create( 			"http://localhost/myservice");   using (varupStream = httpRequest.GetRequestStream()) { // some complicated logic to create the message }   var response = httpRequest.GetResponse(); using (vardownStream = response.GetResponseStream()) { // some complicated logic to handle the response message. }
WebChannelFactory [ServiceContract] publicinterfaceITwitterService {     [OperationContract]     [WebInvoke(UriTemplate = "/friendships/create/{user}.xml")] TwitterUserCreateFriendship(string user); }   using (var factory = newWebChannelFactory<ITwitterService>( 				newUri("http://www.twitter.com/"))) { factory.Credentials.UserName.UserName = username; factory.Credentials.UserName.Password = password; var proxy = factory.CreateChannel(); var user = proxy.CreateFriendship("userToFollow"); }
HttpClient var sample = newSample(); using (var client = newHttpClient()) { client.DefaultRequestHeaders.Accept.Add( newMediaTypeWithQualityHeaderValue("application/json")); client.Post(         "http://localhost/myservice",           newObjectContent(typeof(Sample),               sample,  Sample.JsonMediaType)); }
Tools Fiddlerhttp://www.fiddler2.com/fiddler2/ Firebughttp://getfirebug.com IEWatchhttp://www.iewatch.com/
Show me the code
Implementations OpenRastaOpenRasta brings the concept of REST to the .NET platform in ways that allow it to be deployed alongside ASP.NET and WCF  components. http://trac.caffeine-it.com/openrasta/wiki/Doc http://code.google.com/p/implementing-rest/wiki/ByLanguage
Books

More Related Content

What's hot

Servlet/JSP course chapter 1: Introduction to servlets
Servlet/JSP course chapter 1: Introduction to servletsServlet/JSP course chapter 1: Introduction to servlets
Servlet/JSP course chapter 1: Introduction to servletsJavaEE Trainers
 
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dep...
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dep...Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dep...
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dep...Uniface
 
Servlet and servlet life cycle
Servlet and servlet life cycleServlet and servlet life cycle
Servlet and servlet life cycleDhruvin Nakrani
 
REST in AngularJS
REST in AngularJSREST in AngularJS
REST in AngularJSa_sharif
 
8 Minutes On Rack
8 Minutes On Rack8 Minutes On Rack
8 Minutes On Rackdanwrong
 
Knowledge Sharing : Java Servlet
Knowledge Sharing : Java ServletKnowledge Sharing : Java Servlet
Knowledge Sharing : Java ServletFahmi Jafar
 
Servlet api &amp; servlet http package
Servlet api &amp; servlet http packageServlet api &amp; servlet http package
Servlet api &amp; servlet http packagerenukarenuka9
 
java Servlet technology
java Servlet technologyjava Servlet technology
java Servlet technologyTanmoy Barman
 
Java - Servlet - Mazenet Solution
Java - Servlet - Mazenet SolutionJava - Servlet - Mazenet Solution
Java - Servlet - Mazenet SolutionMazenetsolution
 
Servletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postServletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postvamsi krishna
 
Session And Cookies In Servlets - Java
Session And Cookies In Servlets - JavaSession And Cookies In Servlets - Java
Session And Cookies In Servlets - JavaJainamParikh3
 
Felix HTTP - Paving the road to the future
Felix HTTP - Paving the road to the futureFelix HTTP - Paving the road to the future
Felix HTTP - Paving the road to the futureMarcel Offermans
 
Web Tech Java Servlet Update1
Web Tech   Java Servlet Update1Web Tech   Java Servlet Update1
Web Tech Java Servlet Update1vikram singh
 

What's hot (20)

Servlet/JSP course chapter 1: Introduction to servlets
Servlet/JSP course chapter 1: Introduction to servletsServlet/JSP course chapter 1: Introduction to servlets
Servlet/JSP course chapter 1: Introduction to servlets
 
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dep...
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dep...Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dep...
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dep...
 
Servlet and servlet life cycle
Servlet and servlet life cycleServlet and servlet life cycle
Servlet and servlet life cycle
 
Simple service rest
Simple service restSimple service rest
Simple service rest
 
REST in AngularJS
REST in AngularJSREST in AngularJS
REST in AngularJS
 
Servlet
Servlet Servlet
Servlet
 
8 Minutes On Rack
8 Minutes On Rack8 Minutes On Rack
8 Minutes On Rack
 
Knowledge Sharing : Java Servlet
Knowledge Sharing : Java ServletKnowledge Sharing : Java Servlet
Knowledge Sharing : Java Servlet
 
Servlet api &amp; servlet http package
Servlet api &amp; servlet http packageServlet api &amp; servlet http package
Servlet api &amp; servlet http package
 
Servlet
ServletServlet
Servlet
 
java Servlet technology
java Servlet technologyjava Servlet technology
java Servlet technology
 
How to connect redis and mule esb using spring data redis module
How to connect redis and mule esb using spring data redis moduleHow to connect redis and mule esb using spring data redis module
How to connect redis and mule esb using spring data redis module
 
Java - Servlet - Mazenet Solution
Java - Servlet - Mazenet SolutionJava - Servlet - Mazenet Solution
Java - Servlet - Mazenet Solution
 
Servletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postServletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,post
 
Servlets
ServletsServlets
Servlets
 
Session And Cookies In Servlets - Java
Session And Cookies In Servlets - JavaSession And Cookies In Servlets - Java
Session And Cookies In Servlets - Java
 
Servlets
ServletsServlets
Servlets
 
Felix HTTP - Paving the road to the future
Felix HTTP - Paving the road to the futureFelix HTTP - Paving the road to the future
Felix HTTP - Paving the road to the future
 
Servlet lifecycle
Servlet lifecycleServlet lifecycle
Servlet lifecycle
 
Web Tech Java Servlet Update1
Web Tech   Java Servlet Update1Web Tech   Java Servlet Update1
Web Tech Java Servlet Update1
 

Viewers also liked

A presentation on WCF & REST
A presentation on WCF & RESTA presentation on WCF & REST
A presentation on WCF & RESTSanthu Rao
 
REST in the shade of WCF
REST in the shade of WCFREST in the shade of WCF
REST in the shade of WCFSzymonPobiega
 
WCF tutorial
WCF tutorialWCF tutorial
WCF tutorialAbhi Arya
 
Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Peter R. Egli
 
Web API or WCF - An Architectural Comparison
Web API or WCF - An Architectural ComparisonWeb API or WCF - An Architectural Comparison
Web API or WCF - An Architectural ComparisonAdnan Masood
 
Présentation de WCF
Présentation de WCFPrésentation de WCF
Présentation de WCFRomain Coste
 

Viewers also liked (10)

Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)
 
A presentation on WCF & REST
A presentation on WCF & RESTA presentation on WCF & REST
A presentation on WCF & REST
 
RESTful WCF Services
RESTful WCF ServicesRESTful WCF Services
RESTful WCF Services
 
REST in the shade of WCF
REST in the shade of WCFREST in the shade of WCF
REST in the shade of WCF
 
WCF Fundamentals
WCF Fundamentals WCF Fundamentals
WCF Fundamentals
 
WCF tutorial
WCF tutorialWCF tutorial
WCF tutorial
 
Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)
 
Web API or WCF - An Architectural Comparison
Web API or WCF - An Architectural ComparisonWeb API or WCF - An Architectural Comparison
Web API or WCF - An Architectural Comparison
 
Web services SOAP et REST
Web services  SOAP et RESTWeb services  SOAP et REST
Web services SOAP et REST
 
Présentation de WCF
Présentation de WCFPrésentation de WCF
Présentation de WCF
 

Similar to There is time for rest

Introduction To ASP.NET MVC
Introduction To ASP.NET MVCIntroduction To ASP.NET MVC
Introduction To ASP.NET MVCAlan Dean
 
Spring MVC 3 Restful
Spring MVC 3 RestfulSpring MVC 3 Restful
Spring MVC 3 Restfulknight1128
 
Building+restful+webservice
Building+restful+webserviceBuilding+restful+webservice
Building+restful+webservicelonegunman
 
Rapid API development examples for Impress Application Server / Node.js (jsfw...
Rapid API development examples for Impress Application Server / Node.js (jsfw...Rapid API development examples for Impress Application Server / Node.js (jsfw...
Rapid API development examples for Impress Application Server / Node.js (jsfw...Timur Shemsedinov
 
Server-side Technologies in Java
Server-side Technologies in JavaServer-side Technologies in Java
Server-side Technologies in JavaAnirban Majumdar
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 4...
 Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 4... Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 4...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 4...WebStackAcademy
 
Web services - A Practical Approach
Web services - A Practical ApproachWeb services - A Practical Approach
Web services - A Practical ApproachMadhaiyan Muthu
 
Spring Portlet MVC
Spring Portlet MVCSpring Portlet MVC
Spring Portlet MVCJohn Lewis
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiTiago Knoch
 
RESTful SCA with Apache Tuscany
RESTful SCA with Apache TuscanyRESTful SCA with Apache Tuscany
RESTful SCA with Apache TuscanyRaymond Feng
 
SCWCD 2. servlet req - resp (cap3 - cap4)
SCWCD 2. servlet   req - resp (cap3 - cap4)SCWCD 2. servlet   req - resp (cap3 - cap4)
SCWCD 2. servlet req - resp (cap3 - cap4)Francesco Ierna
 

Similar to There is time for rest (20)

Java Servlets
Java ServletsJava Servlets
Java Servlets
 
Introduction To ASP.NET MVC
Introduction To ASP.NET MVCIntroduction To ASP.NET MVC
Introduction To ASP.NET MVC
 
my accadanic project ppt
my accadanic project pptmy accadanic project ppt
my accadanic project ppt
 
Spring MVC 3 Restful
Spring MVC 3 RestfulSpring MVC 3 Restful
Spring MVC 3 Restful
 
Node js crash course session 2
Node js crash course   session 2Node js crash course   session 2
Node js crash course session 2
 
Building+restful+webservice
Building+restful+webserviceBuilding+restful+webservice
Building+restful+webservice
 
Rapid API development examples for Impress Application Server / Node.js (jsfw...
Rapid API development examples for Impress Application Server / Node.js (jsfw...Rapid API development examples for Impress Application Server / Node.js (jsfw...
Rapid API development examples for Impress Application Server / Node.js (jsfw...
 
Java servlets
Java servletsJava servlets
Java servlets
 
Server-side Technologies in Java
Server-side Technologies in JavaServer-side Technologies in Java
Server-side Technologies in Java
 
ASP.NET WEB API Training
ASP.NET WEB API TrainingASP.NET WEB API Training
ASP.NET WEB API Training
 
Web api
Web apiWeb api
Web api
 
Basics Of Servlet
Basics Of ServletBasics Of Servlet
Basics Of Servlet
 
Sun Web Server Brief
Sun Web Server BriefSun Web Server Brief
Sun Web Server Brief
 
Servlet by Rj
Servlet by RjServlet by Rj
Servlet by Rj
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 4...
 Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 4... Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 4...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 4...
 
Web services - A Practical Approach
Web services - A Practical ApproachWeb services - A Practical Approach
Web services - A Practical Approach
 
Spring Portlet MVC
Spring Portlet MVCSpring Portlet MVC
Spring Portlet MVC
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web api
 
RESTful SCA with Apache Tuscany
RESTful SCA with Apache TuscanyRESTful SCA with Apache Tuscany
RESTful SCA with Apache Tuscany
 
SCWCD 2. servlet req - resp (cap3 - cap4)
SCWCD 2. servlet   req - resp (cap3 - cap4)SCWCD 2. servlet   req - resp (cap3 - cap4)
SCWCD 2. servlet req - resp (cap3 - cap4)
 

More from SoftServe

Go Mobile! Windows Phone 7 for all
Go Mobile! Windows Phone 7 for all Go Mobile! Windows Phone 7 for all
Go Mobile! Windows Phone 7 for all SoftServe
 
Agile frameworks
Agile frameworksAgile frameworks
Agile frameworksSoftServe
 
Managed Extensibility Framework or Effective Development of Scalable Applicat...
Managed Extensibility Framework or Effective Development of Scalable Applicat...Managed Extensibility Framework or Effective Development of Scalable Applicat...
Managed Extensibility Framework or Effective Development of Scalable Applicat...SoftServe
 
SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...
SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...
SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...SoftServe
 
Engineering practices within scrum
Engineering practices within scrumEngineering practices within scrum
Engineering practices within scrumSoftServe
 
Distributed scrum keys to success
Distributed scrum keys to successDistributed scrum keys to success
Distributed scrum keys to successSoftServe
 
Windows Communication Foundation
Windows Communication FoundationWindows Communication Foundation
Windows Communication FoundationSoftServe
 
Mono project
Mono project Mono project
Mono project SoftServe
 
Social networks plus software developers
Social networks plus software developersSocial networks plus software developers
Social networks plus software developersSoftServe
 
Project Management . The Change Agent
Project Management . The Change AgentProject Management . The Change Agent
Project Management . The Change AgentSoftServe
 
Project Management . The Change Agent Vijay Prasad M.Tech, PMP
Project Management . The Change Agent Vijay Prasad M.Tech, PMPProject Management . The Change Agent Vijay Prasad M.Tech, PMP
Project Management . The Change Agent Vijay Prasad M.Tech, PMPSoftServe
 
Project Management -Strategic Competency, & Trends
Project Management -Strategic Competency, & TrendsProject Management -Strategic Competency, & Trends
Project Management -Strategic Competency, & TrendsSoftServe
 
Mobile augmented reality
Mobile augmented realityMobile augmented reality
Mobile augmented realitySoftServe
 
SoftServe - the difference is you! join professionals!
SoftServe - the difference is you! join professionals!SoftServe - the difference is you! join professionals!
SoftServe - the difference is you! join professionals!SoftServe
 
Object oriented reality
Object oriented realityObject oriented reality
Object oriented realitySoftServe
 
Pmo, project objectives and project life cycles
Pmo, project objectives and project life cyclesPmo, project objectives and project life cycles
Pmo, project objectives and project life cyclesSoftServe
 
Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSFSoftServe
 

More from SoftServe (18)

Go Mobile! Windows Phone 7 for all
Go Mobile! Windows Phone 7 for all Go Mobile! Windows Phone 7 for all
Go Mobile! Windows Phone 7 for all
 
Agile frameworks
Agile frameworksAgile frameworks
Agile frameworks
 
Managed Extensibility Framework or Effective Development of Scalable Applicat...
Managed Extensibility Framework or Effective Development of Scalable Applicat...Managed Extensibility Framework or Effective Development of Scalable Applicat...
Managed Extensibility Framework or Effective Development of Scalable Applicat...
 
SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...
SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...
SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...
 
AGILE? YES!
AGILE? YES!AGILE? YES!
AGILE? YES!
 
Engineering practices within scrum
Engineering practices within scrumEngineering practices within scrum
Engineering practices within scrum
 
Distributed scrum keys to success
Distributed scrum keys to successDistributed scrum keys to success
Distributed scrum keys to success
 
Windows Communication Foundation
Windows Communication FoundationWindows Communication Foundation
Windows Communication Foundation
 
Mono project
Mono project Mono project
Mono project
 
Social networks plus software developers
Social networks plus software developersSocial networks plus software developers
Social networks plus software developers
 
Project Management . The Change Agent
Project Management . The Change AgentProject Management . The Change Agent
Project Management . The Change Agent
 
Project Management . The Change Agent Vijay Prasad M.Tech, PMP
Project Management . The Change Agent Vijay Prasad M.Tech, PMPProject Management . The Change Agent Vijay Prasad M.Tech, PMP
Project Management . The Change Agent Vijay Prasad M.Tech, PMP
 
Project Management -Strategic Competency, & Trends
Project Management -Strategic Competency, & TrendsProject Management -Strategic Competency, & Trends
Project Management -Strategic Competency, & Trends
 
Mobile augmented reality
Mobile augmented realityMobile augmented reality
Mobile augmented reality
 
SoftServe - the difference is you! join professionals!
SoftServe - the difference is you! join professionals!SoftServe - the difference is you! join professionals!
SoftServe - the difference is you! join professionals!
 
Object oriented reality
Object oriented realityObject oriented reality
Object oriented reality
 
Pmo, project objectives and project life cycles
Pmo, project objectives and project life cyclesPmo, project objectives and project life cycles
Pmo, project objectives and project life cycles
 
Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSF
 

Recently uploaded

Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard37
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)Samir Dash
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 

Recently uploaded (20)

Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 

There is time for rest

  • 1. There is time for REST WCF REST Services
  • 2. Overview What is REST Rules and Guidelines Hosting a REST Service in .NET Consuming a REST Service with .NET Samples Discussion
  • 3.
  • 6.
  • 10. HTTP Messages Request GET http://localhost:1128/api?$skip=2&$top=2 HTTP/1.1 User-Agent: Fiddler Host: localhost:1128 Accept: application/xml Response HTTP/1.1 200 OK Cache-Control: private Content-Length: 157 Content-Type: application/xml; charset=utf-8 Server: Microsoft-IIS/7.5 Date: Fri, 26 Aug 2011 18:51:22 GMT <?xml version="1.0" encoding="utf-8"?> <Data />
  • 11. URIs RPC (SOAP) Interface http://example.com/CarsService/getYears http://example.com/CarsService/getMakes http://example.com/CarsService/getAutomobile http://example.com/CarsService/updateAutomobile http://example.com/CarsService/deleteAutomobile
  • 12. URIs RESTful Interface No need to distinguish get/update/delete, that’s what the HTTP Method is for Collection http://example.com/2011/Honda/ Resource http://example.com/2011/Honda/Civic/2.0
  • 13. Return Types XML XHTML ATOM Publishing Protocol RSS Custom (should contain hyperlinks) JSON Custom
  • 14. WCF and REST WCF 4 REST REST endpoints Uri templates for routing WCF Hosting (Console, IIS, etc) etc.
  • 15. WCF 4 REST, Web Api Programming model for HTTP in WCF Access HTTP from top to bottom REST endpoints Uri templates for routing WCF Hosting (Console, IIS, etc) etc. Http Client Plug in any format / media type Typeless JSON support IQueryablesupport
  • 16. WCF REST contract [ServiceContract] publicinterfaceIAutomobileService { [OperationContract] [WebGet(UriTemplate = "*")] Message Get(); [OperationContract] [WebInvoke(Method = "PUT", UriTemplate = "*")] Message Put(Message data); }
  • 17. Uri Templates [ServiceContract] public interface IAutomobileService { [OperationContract] [WebGet(UriTemplate = "/{year}/{make}/{model}/{engine}")] AutomobilesGetAutomobiles(string year, string make, string model, string engine); }
  • 18. Routing staticvoidRegisterRoutes(RouteCollection routes) { routes.MapServiceRoute<SampleResource>("api"); } voidApplication_Start(objectsender,EventArgs e) { RegisterRoutes(RouteTable.Routes); }
  • 20. WebRequest varhttpRequest = (HttpWebRequest)WebRequest.Create( "http://localhost/myservice");   using (varupStream = httpRequest.GetRequestStream()) { // some complicated logic to create the message }   var response = httpRequest.GetResponse(); using (vardownStream = response.GetResponseStream()) { // some complicated logic to handle the response message. }
  • 21. WebChannelFactory [ServiceContract] publicinterfaceITwitterService { [OperationContract] [WebInvoke(UriTemplate = "/friendships/create/{user}.xml")] TwitterUserCreateFriendship(string user); }   using (var factory = newWebChannelFactory<ITwitterService>( newUri("http://www.twitter.com/"))) { factory.Credentials.UserName.UserName = username; factory.Credentials.UserName.Password = password; var proxy = factory.CreateChannel(); var user = proxy.CreateFriendship("userToFollow"); }
  • 22. HttpClient var sample = newSample(); using (var client = newHttpClient()) { client.DefaultRequestHeaders.Accept.Add( newMediaTypeWithQualityHeaderValue("application/json")); client.Post( "http://localhost/myservice", newObjectContent(typeof(Sample), sample, Sample.JsonMediaType)); }
  • 24. Show me the code
  • 25. Implementations OpenRastaOpenRasta brings the concept of REST to the .NET platform in ways that allow it to be deployed alongside ASP.NET and WCF components. http://trac.caffeine-it.com/openrasta/wiki/Doc http://code.google.com/p/implementing-rest/wiki/ByLanguage
  • 26. Books
  • 27.