SlideShare a Scribd company logo
1 of 29
Download to read offline
REST, JSON and RSS with
Windows Communication
Foundation 3.5


Rob Windsor
ObjectSharp Consulting
rwindsor@objectsharp.com
Me.About

 Visual Basic MVP
 Senior Consultant with ObjectSharp Consulting
 President of the Toronto Visual Basic User
 Group
 Member of the MSDN Canada Speakers Bureau
 Contact me via my blog
   http://msmvps.com/windsor
Agenda
 WCF Overview
 JSON Services
 HTTP Programming Model
 Syndication
Windows Communication Foundation
  One-stop-shop for services
  Consistent object model
  First released with .NET Framework 3.0

Focus on the functionality, WCF takes care of the
                    plumbing
The ABCs of WCF


  Client                                             Service
                                           A     B   C

           C   B    A        Message       A     B   C




               Address       Binding   Contract
                   (Where)    (How)     (What)
WCF Standard Bindings
Name                    Transport    Encoding     Interop
BasicHttpBinding        HTTP/HTTPS   Text         Yes
NetTcpBinding           TCP          Binary       No
NetPeerTcpBinding       P2P          Binary       No
NetNamedPipeBinding     IPC          Binary       No
WSHttpBinding           HTTP/HTTPS   Text, MTOM   Yes
WSFederationBinding     HTTP/HTTPS   Text, MTOM   Yes
WSDualHttpBinding       HTTP/HTTPS   Text, MTOM   Yes
NetMsmqBinding          MSMQ         Binary       No
NetIntegrationBinding   MSMQ         Binary       Yes
WCF Services
Agenda
 WCF Overview
 JSON Services
 HTTP Programming Model
 Syndication
What is JSON?
  JavaScript Object Notation
  Format for bridging JavaScript and objects
     Easier for browsers than XML
  ASP.NET AJAX & other AJAX toolkits use it
     Other web-aware clients also (Silverlight, etc.)


var data = {“temp” : 59, “descr” : “cloudy”};
document.write (“The weather is “ + data.descr);
WCF / AJAX Integration
 WCF AJAX support in Visual Studio
    Script manager, VS Project Templates
 WCF automatically generates JS proxy
 Usage pattern similar to existing one:
    Add service to Script Manager control
    Write JavaScript code to work with proxy
 Configuration not required
    Via the WebScriptServiceHostFactory (.svc file)


       Works in ASP.NET Medium Trust!
JSON Services
Agenda
 WCF Overview
 JSON Services
 HTTP Programming Model
 Syndication
Web Concepts (REST)
 Embrace the URI
    Segments map to application logic
 HTTP GET is special
    GET is idempotent (View It)
     Multiple GETs to a URI should produce the same (or similar)
     results
    PUT / POST / DELETE do “stuff” (Do It)
 Content-type header is the data model
    Image, XML, JSON, etc.
The Web, the URI, and Apps

objectsharp.com/artists/Flaming+Hammer/HitMe
objectsharp.com/artists/Northwind/Overdone


objectsharp.com/artists/{artist}/{album}



objectsharp.com/artists/Flaming+Hammer?album=HitMe
objectsharp.com/artists/Northwind?album=Overdone


objectsharp.com/astists/{artist}?album={album}
Modeling a URI in .NET 3.5
 System.UriTemplate
   Type for modeling URI to application semantics
   Can “bind” data to a template, output a URI
   Can “match” a URI to a template, retrieve data
 System.UriTemplateMatch
   Returned from UriTemplate “match” operations
   Can get relative paths and wildcard segments
 System.UriTemplateTable
   For “binding” a URI to a group of UriTemplates
Roundtrip Data in a URI

Uri address = new Uri(“http://localhost:2000”);
UriTemplate template =
 new UriTemplate(“{artist}/{album}”);
Uri boundUri =
 template.BindByPosition(address,
                         “Northwind”, “Overdone”);
UriTemplateMatch match = template.Match(address,
                                        boundUri);
String bandName = match.BoundVariables[“artist”];
URIs in WCF Contracts
 Simple URI-to-application mapping


[OperationContract]
[WebGet(UriTemplate=“/Image/{artist}/{album}”)]
Stream GetAlbumImage(String artist, String album);


[OperationContract]
[WebGet(UriTemplate=“/Image?name={artist})]
Stream GetMainImage(String artist);
HTTP Verbs in WCF Contracts
 All HTTP verbs are first class citizens
    GET, POST, PUT, etc.
 “View It” vs “Do It” separation mimics web

[OperationContract]
[WebGet(UriTemplate=“/Image/{bandName}/{album}”)]
Stream GetAlbumImage(String bandName, String album);


[OperationContract]
[WebInvoke(METHOD=“PUT”)] // {PUT, POST, DELETE}
void AddAlbum(AlbumInfo albumInfo);
Data Formats and the Web
 HTTP headers can indicate
    Accepted data formats (Request)
    The format of the returned data (Response)
 Common header names:
    Accept (Request), Content-Type (Response)
 Small sampling of varieties:
    text/html, text/css,
    image/gif, image/jpeg,
    application/atom+xml, application/json,
    video/mp4
Specifying Data Format in WCF
    WebOperationContext.Current provides access to
    incoming request headers
    Can also set outgoing response headers
        Some are shortcut for easier use

Stream GetAlbumImage(String bandName, String album){
    Stream stream; // get the image from somewhere
    WebOperationContext.Current.OutgoingResponse.ContentType =
     “image/jpeg”;
    return stream;
}
Hosting / Binding
 WebHttpBinding endpoint on a ServiceHost
    Add WebHttpBehavior to the endpoint
 Use WebServiceHost/Factory in most cases
 Web endpoints do not support WSDL

      Works in ASP.NET Medium Trust!
View It and Do It
Agenda
 Level-set
 JSON Services
 HTTP Programming Model
 Syndication
Syndication Goals in .NET 3.5
 Syndications are more than news and blogs
    Representation of any set of data
    Usually slowly changing
 Unified object model for RSS and Atom
    SyndicationFeed / SyndicationItem
 Feeds are service operations
 Consume as a service or as document
Syndication in .NET Fx 3.5
 Single stop for syndications
    Create and Consume with or without WCF
 Easy to use object model
 Transport Agnostic
 Supports syndication extensions
 Format Agnostic
    RSS 2.0 & ATOM 1.0, others possible

           Works in ASP.NET Medium Trust!
Syndication Contracts in WCF


[ServiceKnownType(typeof(Atom10FeedFormatter))]
[ServiceKnownType(typeof(Rss20FeedFormatter))]
[ServiceContract]
interface IAlbumSyndication {
    [OperationContract]
    [WebGet(UriTemplate=“Images/{format}quot;)]
    SyndicationFeedFormatter<SyndicationFeed>
     Feed(String format);
}
Syndication with PictureServices
Web Centric Features in WCF 3.5

 Simple HTTP service development
 SOAP and POX from the same contract
 JSON messaging capability
 Simple syndication – really!



                  Built on WCF
                extensibility points
                  from .NET 3.0
Resources
 Microsoft WCF Community Site
   http://wcf.netfx3.com/
 PictureServices Samples
   http://www.cloudsamples.net/pictureservices/
 The EndPoint on Channel 9
   http://channel9.msdn.com/shows/The_EndPoint
 Justin Smith’s Blog
   http://blogs.msdn.com/justinjsmith/
 Steve Maine’s Blog
   http://hyperthink.net/blog/
 Getting Started with WCF
   http://msdn2.microsoft.com/en-us/vbasic/bb736015.aspx

More Related Content

What's hot

Beginning with wcf service
Beginning with wcf serviceBeginning with wcf service
Beginning with wcf serviceBinu Bhasuran
 
Building RESTful Services with WCF 4.0
Building RESTful Services with WCF 4.0Building RESTful Services with WCF 4.0
Building RESTful Services with WCF 4.0Saltmarch Media
 
Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Peter R. Egli
 
Wcf architecture overview
Wcf architecture overviewWcf architecture overview
Wcf architecture overviewArbind Tiwari
 
Introduction to WCF
Introduction to WCFIntroduction to WCF
Introduction to WCFybbest
 
Interoperability and Windows Communication Foundation (WCF) Overview
Interoperability and Windows Communication Foundation (WCF) OverviewInteroperability and Windows Communication Foundation (WCF) Overview
Interoperability and Windows Communication Foundation (WCF) OverviewJorgen Thelin
 
WCF tutorial
WCF tutorialWCF tutorial
WCF tutorialAbhi Arya
 
Windows Communication Foundation (WCF) Service
Windows Communication Foundation (WCF) ServiceWindows Communication Foundation (WCF) Service
Windows Communication Foundation (WCF) ServiceSj Lim
 
1. WCF Services - Exam 70-487
1. WCF Services - Exam 70-4871. WCF Services - Exam 70-487
1. WCF Services - Exam 70-487Bat Programmer
 
Session 1: The SOAP Story
Session 1: The SOAP StorySession 1: The SOAP Story
Session 1: The SOAP Storyukdpe
 
Web services, WCF services and Multi Threading with Windows Forms
Web services, WCF services and Multi Threading with Windows FormsWeb services, WCF services and Multi Threading with Windows Forms
Web services, WCF services and Multi Threading with Windows FormsPeter Gfader
 
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUI
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUIAdvancio, Inc. Academy: Web Sevices, WCF & SOAPUI
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUIAdvancio
 
Understanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company indiaUnderstanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company indiaJignesh Aakoliya
 
Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)Peter R. Egli
 
Top wcf interview questions
Top wcf interview questionsTop wcf interview questions
Top wcf interview questionstongdang
 

What's hot (20)

WCF And ASMX Web Services
WCF And ASMX Web ServicesWCF And ASMX Web Services
WCF And ASMX Web Services
 
Beginning with wcf service
Beginning with wcf serviceBeginning with wcf service
Beginning with wcf service
 
Building RESTful Services with WCF 4.0
Building RESTful Services with WCF 4.0Building RESTful Services with WCF 4.0
Building RESTful Services with WCF 4.0
 
Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)
 
Wcf architecture overview
Wcf architecture overviewWcf architecture overview
Wcf architecture overview
 
WCF
WCFWCF
WCF
 
Introduction to WCF
Introduction to WCFIntroduction to WCF
Introduction to WCF
 
WCF for begineers
WCF  for begineersWCF  for begineers
WCF for begineers
 
Interoperability and Windows Communication Foundation (WCF) Overview
Interoperability and Windows Communication Foundation (WCF) OverviewInteroperability and Windows Communication Foundation (WCF) Overview
Interoperability and Windows Communication Foundation (WCF) Overview
 
WCF
WCFWCF
WCF
 
WCF tutorial
WCF tutorialWCF tutorial
WCF tutorial
 
Windows Communication Foundation (WCF) Best Practices
Windows Communication Foundation (WCF) Best PracticesWindows Communication Foundation (WCF) Best Practices
Windows Communication Foundation (WCF) Best Practices
 
Windows Communication Foundation (WCF) Service
Windows Communication Foundation (WCF) ServiceWindows Communication Foundation (WCF) Service
Windows Communication Foundation (WCF) Service
 
1. WCF Services - Exam 70-487
1. WCF Services - Exam 70-4871. WCF Services - Exam 70-487
1. WCF Services - Exam 70-487
 
Session 1: The SOAP Story
Session 1: The SOAP StorySession 1: The SOAP Story
Session 1: The SOAP Story
 
Web services, WCF services and Multi Threading with Windows Forms
Web services, WCF services and Multi Threading with Windows FormsWeb services, WCF services and Multi Threading with Windows Forms
Web services, WCF services and Multi Threading with Windows Forms
 
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUI
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUIAdvancio, Inc. Academy: Web Sevices, WCF & SOAPUI
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUI
 
Understanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company indiaUnderstanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company india
 
Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)
 
Top wcf interview questions
Top wcf interview questionsTop wcf interview questions
Top wcf interview questions
 

Viewers also liked

REST/JSON/CoreData Example Code - A Tour
REST/JSON/CoreData Example Code - A TourREST/JSON/CoreData Example Code - A Tour
REST/JSON/CoreData Example Code - A TourCarl Brown
 
Tarea sesion 3
Tarea sesion 3Tarea sesion 3
Tarea sesion 3zizyphuz
 
ERP Highlights £ Điểm nổi bật của ERP
ERP Highlights £ Điểm nổi bật của ERPERP Highlights £ Điểm nổi bật của ERP
ERP Highlights £ Điểm nổi bật của ERPThuc Pham Chuc Nang
 
RESTful services
RESTful servicesRESTful services
RESTful servicesgouthamrv
 
Hybris 6.0.0 to 6.3.0 comparision
Hybris 6.0.0 to 6.3.0 comparisionHybris 6.0.0 to 6.3.0 comparision
Hybris 6.0.0 to 6.3.0 comparisionShinu Suresh
 
Building and deploying microservices with event sourcing, CQRS and Docker (Be...
Building and deploying microservices with event sourcing, CQRS and Docker (Be...Building and deploying microservices with event sourcing, CQRS and Docker (Be...
Building and deploying microservices with event sourcing, CQRS and Docker (Be...Chris Richardson
 
Developing microservices with aggregates (SpringOne platform, #s1p)
Developing microservices with aggregates (SpringOne platform, #s1p)Developing microservices with aggregates (SpringOne platform, #s1p)
Developing microservices with aggregates (SpringOne platform, #s1p)Chris Richardson
 
Handling Eventual Consistency in JVM Microservices with Event Sourcing (javao...
Handling Eventual Consistency in JVM Microservices with Event Sourcing (javao...Handling Eventual Consistency in JVM Microservices with Event Sourcing (javao...
Handling Eventual Consistency in JVM Microservices with Event Sourcing (javao...Chris Richardson
 

Viewers also liked (12)

AJITH_S
AJITH_SAJITH_S
AJITH_S
 
Direccion del proyecto (1)
Direccion del proyecto (1)Direccion del proyecto (1)
Direccion del proyecto (1)
 
Advice for rural development
Advice for rural developmentAdvice for rural development
Advice for rural development
 
REST/JSON/CoreData Example Code - A Tour
REST/JSON/CoreData Example Code - A TourREST/JSON/CoreData Example Code - A Tour
REST/JSON/CoreData Example Code - A Tour
 
Tarea sesion 3
Tarea sesion 3Tarea sesion 3
Tarea sesion 3
 
ERP Highlights £ Điểm nổi bật của ERP
ERP Highlights £ Điểm nổi bật của ERPERP Highlights £ Điểm nổi bật của ERP
ERP Highlights £ Điểm nổi bật của ERP
 
RESTful services
RESTful servicesRESTful services
RESTful services
 
Hybris 6.0.0 to 6.3.0 comparision
Hybris 6.0.0 to 6.3.0 comparisionHybris 6.0.0 to 6.3.0 comparision
Hybris 6.0.0 to 6.3.0 comparision
 
Resume_VipinKP
Resume_VipinKPResume_VipinKP
Resume_VipinKP
 
Building and deploying microservices with event sourcing, CQRS and Docker (Be...
Building and deploying microservices with event sourcing, CQRS and Docker (Be...Building and deploying microservices with event sourcing, CQRS and Docker (Be...
Building and deploying microservices with event sourcing, CQRS and Docker (Be...
 
Developing microservices with aggregates (SpringOne platform, #s1p)
Developing microservices with aggregates (SpringOne platform, #s1p)Developing microservices with aggregates (SpringOne platform, #s1p)
Developing microservices with aggregates (SpringOne platform, #s1p)
 
Handling Eventual Consistency in JVM Microservices with Event Sourcing (javao...
Handling Eventual Consistency in JVM Microservices with Event Sourcing (javao...Handling Eventual Consistency in JVM Microservices with Event Sourcing (javao...
Handling Eventual Consistency in JVM Microservices with Event Sourcing (javao...
 

Similar to REST, JSON and RSS with WCF 3.5

Building+restful+webservice
Building+restful+webserviceBuilding+restful+webservice
Building+restful+webservicelonegunman
 
DEV301- Web Service Programming with WCF 3.5
DEV301- Web Service Programming with WCF 3.5DEV301- Web Service Programming with WCF 3.5
DEV301- Web Service Programming with WCF 3.5Eyal Vardi
 
Xml web services
Xml web servicesXml web services
Xml web servicesRaghu nath
 
Reusing Existing Java EE Applications from SOA Suite 11g
Reusing Existing Java EE Applications from SOA Suite 11gReusing Existing Java EE Applications from SOA Suite 11g
Reusing Existing Java EE Applications from SOA Suite 11gGuido Schmutz
 
Json-based Service Oriented Architecture for the web
Json-based Service Oriented Architecture for the webJson-based Service Oriented Architecture for the web
Json-based Service Oriented Architecture for the webkriszyp
 
jkljklj
jkljkljjkljklj
jkljkljhoefo
 
DevNext - Web Programming Concepts Using Asp Net
DevNext - Web Programming Concepts Using Asp NetDevNext - Web Programming Concepts Using Asp Net
DevNext - Web Programming Concepts Using Asp NetAdil Mughal
 
Interoperable Web Services with JAX-WS and WSIT
Interoperable Web Services with JAX-WS and WSITInteroperable Web Services with JAX-WS and WSIT
Interoperable Web Services with JAX-WS and WSITCarol McDonald
 
Ado.Net Data Services (Astoria)
Ado.Net Data Services (Astoria)Ado.Net Data Services (Astoria)
Ado.Net Data Services (Astoria)Igor Moochnick
 
AK 3 web services using apache axis
AK 3   web services using apache axisAK 3   web services using apache axis
AK 3 web services using apache axisgauravashq
 
Intro to web services
Intro to web servicesIntro to web services
Intro to web servicesNeil Ghosh
 
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
 
.Net3.5 Overview
.Net3.5 Overview.Net3.5 Overview
.Net3.5 Overviewllangit
 
Introducing SOA and Oracle SOA Suite 11g for Database Professionals
Introducing SOA and Oracle SOA Suite 11g for Database ProfessionalsIntroducing SOA and Oracle SOA Suite 11g for Database Professionals
Introducing SOA and Oracle SOA Suite 11g for Database ProfessionalsLucas Jellema
 

Similar to REST, JSON and RSS with WCF 3.5 (20)

Building+restful+webservice
Building+restful+webserviceBuilding+restful+webservice
Building+restful+webservice
 
DEV301- Web Service Programming with WCF 3.5
DEV301- Web Service Programming with WCF 3.5DEV301- Web Service Programming with WCF 3.5
DEV301- Web Service Programming with WCF 3.5
 
Xml web services
Xml web servicesXml web services
Xml web services
 
Reusing Existing Java EE Applications from SOA Suite 11g
Reusing Existing Java EE Applications from SOA Suite 11gReusing Existing Java EE Applications from SOA Suite 11g
Reusing Existing Java EE Applications from SOA Suite 11g
 
Json-based Service Oriented Architecture for the web
Json-based Service Oriented Architecture for the webJson-based Service Oriented Architecture for the web
Json-based Service Oriented Architecture for the web
 
ASP.NET WEB API Training
ASP.NET WEB API TrainingASP.NET WEB API Training
ASP.NET WEB API Training
 
jkljklj
jkljkljjkljklj
jkljklj
 
RESTful WCF Services
RESTful WCF ServicesRESTful WCF Services
RESTful WCF Services
 
DevNext - Web Programming Concepts Using Asp Net
DevNext - Web Programming Concepts Using Asp NetDevNext - Web Programming Concepts Using Asp Net
DevNext - Web Programming Concepts Using Asp Net
 
Practical OData
Practical ODataPractical OData
Practical OData
 
Interoperable Web Services with JAX-WS and WSIT
Interoperable Web Services with JAX-WS and WSITInteroperable Web Services with JAX-WS and WSIT
Interoperable Web Services with JAX-WS and WSIT
 
Ado.Net Data Services (Astoria)
Ado.Net Data Services (Astoria)Ado.Net Data Services (Astoria)
Ado.Net Data Services (Astoria)
 
AK 3 web services using apache axis
AK 3   web services using apache axisAK 3   web services using apache axis
AK 3 web services using apache axis
 
Intro to web services
Intro to web servicesIntro to web services
Intro to web services
 
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
 
.Net3.5 Overview
.Net3.5 Overview.Net3.5 Overview
.Net3.5 Overview
 
Introducing SOA and Oracle SOA Suite 11g for Database Professionals
Introducing SOA and Oracle SOA Suite 11g for Database ProfessionalsIntroducing SOA and Oracle SOA Suite 11g for Database Professionals
Introducing SOA and Oracle SOA Suite 11g for Database Professionals
 
Web 2 0 Tools
Web 2 0 ToolsWeb 2 0 Tools
Web 2 0 Tools
 
Divide et impera
Divide et imperaDivide et impera
Divide et impera
 
SOA and web services
SOA and web servicesSOA and web services
SOA and web services
 

More from Rob Windsor

JavaScript and jQuery for SharePoint Developers
JavaScript and jQuery for SharePoint DevelopersJavaScript and jQuery for SharePoint Developers
JavaScript and jQuery for SharePoint DevelopersRob Windsor
 
Introduction to the SharePoint Client Object Model and REST API
Introduction to the SharePoint Client Object Model and REST APIIntroduction to the SharePoint Client Object Model and REST API
Introduction to the SharePoint Client Object Model and REST APIRob Windsor
 
Advanced SharePoint Web Part Development
Advanced SharePoint Web Part DevelopmentAdvanced SharePoint Web Part Development
Advanced SharePoint Web Part DevelopmentRob Windsor
 
Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010Rob Windsor
 
Integrating SharePoint 2010 and Visual Studio Lightswitch
Integrating SharePoint 2010 and Visual Studio LightswitchIntegrating SharePoint 2010 and Visual Studio Lightswitch
Integrating SharePoint 2010 and Visual Studio LightswitchRob Windsor
 
SharePoint 2010 Application Development Overview
SharePoint 2010 Application Development OverviewSharePoint 2010 Application Development Overview
SharePoint 2010 Application Development OverviewRob Windsor
 
Integrating ASP.NET AJAX with SharePoint
Integrating ASP.NET AJAX with SharePointIntegrating ASP.NET AJAX with SharePoint
Integrating ASP.NET AJAX with SharePointRob Windsor
 

More from Rob Windsor (7)

JavaScript and jQuery for SharePoint Developers
JavaScript and jQuery for SharePoint DevelopersJavaScript and jQuery for SharePoint Developers
JavaScript and jQuery for SharePoint Developers
 
Introduction to the SharePoint Client Object Model and REST API
Introduction to the SharePoint Client Object Model and REST APIIntroduction to the SharePoint Client Object Model and REST API
Introduction to the SharePoint Client Object Model and REST API
 
Advanced SharePoint Web Part Development
Advanced SharePoint Web Part DevelopmentAdvanced SharePoint Web Part Development
Advanced SharePoint Web Part Development
 
Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010
 
Integrating SharePoint 2010 and Visual Studio Lightswitch
Integrating SharePoint 2010 and Visual Studio LightswitchIntegrating SharePoint 2010 and Visual Studio Lightswitch
Integrating SharePoint 2010 and Visual Studio Lightswitch
 
SharePoint 2010 Application Development Overview
SharePoint 2010 Application Development OverviewSharePoint 2010 Application Development Overview
SharePoint 2010 Application Development Overview
 
Integrating ASP.NET AJAX with SharePoint
Integrating ASP.NET AJAX with SharePointIntegrating ASP.NET AJAX with SharePoint
Integrating ASP.NET AJAX with SharePoint
 

Recently uploaded

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 

Recently uploaded (20)

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 

REST, JSON and RSS with WCF 3.5

  • 1. REST, JSON and RSS with Windows Communication Foundation 3.5 Rob Windsor ObjectSharp Consulting rwindsor@objectsharp.com
  • 2. Me.About Visual Basic MVP Senior Consultant with ObjectSharp Consulting President of the Toronto Visual Basic User Group Member of the MSDN Canada Speakers Bureau Contact me via my blog http://msmvps.com/windsor
  • 3. Agenda WCF Overview JSON Services HTTP Programming Model Syndication
  • 4. Windows Communication Foundation One-stop-shop for services Consistent object model First released with .NET Framework 3.0 Focus on the functionality, WCF takes care of the plumbing
  • 5. The ABCs of WCF Client Service A B C C B A Message A B C Address Binding Contract (Where) (How) (What)
  • 6. WCF Standard Bindings Name Transport Encoding Interop BasicHttpBinding HTTP/HTTPS Text Yes NetTcpBinding TCP Binary No NetPeerTcpBinding P2P Binary No NetNamedPipeBinding IPC Binary No WSHttpBinding HTTP/HTTPS Text, MTOM Yes WSFederationBinding HTTP/HTTPS Text, MTOM Yes WSDualHttpBinding HTTP/HTTPS Text, MTOM Yes NetMsmqBinding MSMQ Binary No NetIntegrationBinding MSMQ Binary Yes
  • 8. Agenda WCF Overview JSON Services HTTP Programming Model Syndication
  • 9. What is JSON? JavaScript Object Notation Format for bridging JavaScript and objects Easier for browsers than XML ASP.NET AJAX & other AJAX toolkits use it Other web-aware clients also (Silverlight, etc.) var data = {“temp” : 59, “descr” : “cloudy”}; document.write (“The weather is “ + data.descr);
  • 10. WCF / AJAX Integration WCF AJAX support in Visual Studio Script manager, VS Project Templates WCF automatically generates JS proxy Usage pattern similar to existing one: Add service to Script Manager control Write JavaScript code to work with proxy Configuration not required Via the WebScriptServiceHostFactory (.svc file) Works in ASP.NET Medium Trust!
  • 12. Agenda WCF Overview JSON Services HTTP Programming Model Syndication
  • 13. Web Concepts (REST) Embrace the URI Segments map to application logic HTTP GET is special GET is idempotent (View It) Multiple GETs to a URI should produce the same (or similar) results PUT / POST / DELETE do “stuff” (Do It) Content-type header is the data model Image, XML, JSON, etc.
  • 14. The Web, the URI, and Apps objectsharp.com/artists/Flaming+Hammer/HitMe objectsharp.com/artists/Northwind/Overdone objectsharp.com/artists/{artist}/{album} objectsharp.com/artists/Flaming+Hammer?album=HitMe objectsharp.com/artists/Northwind?album=Overdone objectsharp.com/astists/{artist}?album={album}
  • 15. Modeling a URI in .NET 3.5 System.UriTemplate Type for modeling URI to application semantics Can “bind” data to a template, output a URI Can “match” a URI to a template, retrieve data System.UriTemplateMatch Returned from UriTemplate “match” operations Can get relative paths and wildcard segments System.UriTemplateTable For “binding” a URI to a group of UriTemplates
  • 16. Roundtrip Data in a URI Uri address = new Uri(“http://localhost:2000”); UriTemplate template = new UriTemplate(“{artist}/{album}”); Uri boundUri = template.BindByPosition(address, “Northwind”, “Overdone”); UriTemplateMatch match = template.Match(address, boundUri); String bandName = match.BoundVariables[“artist”];
  • 17. URIs in WCF Contracts Simple URI-to-application mapping [OperationContract] [WebGet(UriTemplate=“/Image/{artist}/{album}”)] Stream GetAlbumImage(String artist, String album); [OperationContract] [WebGet(UriTemplate=“/Image?name={artist})] Stream GetMainImage(String artist);
  • 18. HTTP Verbs in WCF Contracts All HTTP verbs are first class citizens GET, POST, PUT, etc. “View It” vs “Do It” separation mimics web [OperationContract] [WebGet(UriTemplate=“/Image/{bandName}/{album}”)] Stream GetAlbumImage(String bandName, String album); [OperationContract] [WebInvoke(METHOD=“PUT”)] // {PUT, POST, DELETE} void AddAlbum(AlbumInfo albumInfo);
  • 19. Data Formats and the Web HTTP headers can indicate Accepted data formats (Request) The format of the returned data (Response) Common header names: Accept (Request), Content-Type (Response) Small sampling of varieties: text/html, text/css, image/gif, image/jpeg, application/atom+xml, application/json, video/mp4
  • 20. Specifying Data Format in WCF WebOperationContext.Current provides access to incoming request headers Can also set outgoing response headers Some are shortcut for easier use Stream GetAlbumImage(String bandName, String album){ Stream stream; // get the image from somewhere WebOperationContext.Current.OutgoingResponse.ContentType = “image/jpeg”; return stream; }
  • 21. Hosting / Binding WebHttpBinding endpoint on a ServiceHost Add WebHttpBehavior to the endpoint Use WebServiceHost/Factory in most cases Web endpoints do not support WSDL Works in ASP.NET Medium Trust!
  • 22. View It and Do It
  • 23. Agenda Level-set JSON Services HTTP Programming Model Syndication
  • 24. Syndication Goals in .NET 3.5 Syndications are more than news and blogs Representation of any set of data Usually slowly changing Unified object model for RSS and Atom SyndicationFeed / SyndicationItem Feeds are service operations Consume as a service or as document
  • 25. Syndication in .NET Fx 3.5 Single stop for syndications Create and Consume with or without WCF Easy to use object model Transport Agnostic Supports syndication extensions Format Agnostic RSS 2.0 & ATOM 1.0, others possible Works in ASP.NET Medium Trust!
  • 26. Syndication Contracts in WCF [ServiceKnownType(typeof(Atom10FeedFormatter))] [ServiceKnownType(typeof(Rss20FeedFormatter))] [ServiceContract] interface IAlbumSyndication { [OperationContract] [WebGet(UriTemplate=“Images/{format}quot;)] SyndicationFeedFormatter<SyndicationFeed> Feed(String format); }
  • 28. Web Centric Features in WCF 3.5 Simple HTTP service development SOAP and POX from the same contract JSON messaging capability Simple syndication – really! Built on WCF extensibility points from .NET 3.0
  • 29. Resources Microsoft WCF Community Site http://wcf.netfx3.com/ PictureServices Samples http://www.cloudsamples.net/pictureservices/ The EndPoint on Channel 9 http://channel9.msdn.com/shows/The_EndPoint Justin Smith’s Blog http://blogs.msdn.com/justinjsmith/ Steve Maine’s Blog http://hyperthink.net/blog/ Getting Started with WCF http://msdn2.microsoft.com/en-us/vbasic/bb736015.aspx