1 / 28

Windows Communication Foundation: Introduction

bradley
Download Presentation

Windows Communication Foundation: Introduction

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


    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. WCF Overview JSON Services HTTP Programming Model Syndication Agenda Purpose of this slide: Set the expectations for how the talk is going to proceed. Points to Make: The presentation is separated into 4 topics that track with the new features in WCF Level set: helps us understand the purpose of these new features, and helps to ensure we are all on the same page From a Web perspective, there are 3 relevant features added to WCF: An enhanced HTTP programming model 1st class support for JSON services And finally a single place to go for consuming and serving syndicated content Purpose of this slide: Set the expectations for how the talk is going to proceed. Points to Make: The presentation is separated into 4 topics that track with the new features in WCF Level set: helps us understand the purpose of these new features, and helps to ensure we are all on the same page From a Web perspective, there are 3 relevant features added to WCF: An enhanced HTTP programming model 1st class support for JSON services And finally a single place to go for consuming and serving syndicated content

    4. 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 Windows Communication Foundation Purpose of this Slide: Give the attendees the pitch for why WCF is valuable. Points to Make: WCF is the technology for building and consuming services on Windows It has an object model thats consistent against a wide range of functionality (durability, reliablity, transactional behavior, WS-* interop, basic interop, interprocess communication, etc). In the past, these capabilities were spread across several technologies. Taking a bet on one meant your app was closely tied to that technology. If future demands required the inclusion of a new set of communication functionality, you had to get busy coding. WCF makes it easy. Developers learn WCF and they can code services with lots of different behaviors. WCF includes lots of ility features that help debugging, maintenance, and the overall manageability of a WCF application. These include: tracing, logging, DoS throttles, instance controls, threading and concurrency controls, etc. WCF was first released with the .NET Framework 3.0 Services are some functionality exposed via a structured messaging scheme. WCF allows you to focus on the functionality, while the framework takes care of the plumbing. Purpose of this Slide: Give the attendees the pitch for why WCF is valuable. Points to Make: WCF is the technology for building and consuming services on Windows It has an object model thats consistent against a wide range of functionality (durability, reliablity, transactional behavior, WS-* interop, basic interop, interprocess communication, etc). In the past, these capabilities were spread across several technologies. Taking a bet on one meant your app was closely tied to that technology. If future demands required the inclusion of a new set of communication functionality, you had to get busy coding. WCF makes it easy. Developers learn WCF and they can code services with lots of different behaviors. WCF includes lots of ility features that help debugging, maintenance, and the overall manageability of a WCF application. These include: tracing, logging, DoS throttles, instance controls, threading and concurrency controls, etc. WCF was first released with the .NET Framework 3.0 Services are some functionality exposed via a structured messaging scheme. WCF allows you to focus on the functionality, while the framework takes care of the plumbing.

    5. The ABCs of WCF

    6. WCF Standard Bindings

    7. WCF Services

    8. WCF Overview JSON Services HTTP Programming Model Syndication Agenda Purpose of this Slide: Introduce the JSON messaging capabilities of WCF in .NET 3.5 Main Points to Make: The WCF team also added some new messaging capabilities to the framework that greatly enhance its reach to different clients. We now have 1st class support for JSON services. Purpose of this Slide: Introduce the JSON messaging capabilities of WCF in .NET 3.5 Main Points to Make: The WCF team also added some new messaging capabilities to the framework that greatly enhance its reach to different clients. We now have 1st class support for JSON services.

    9. 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.) What is JSON? Purpose of this Slide: Describe what JSON is, where it is used, and why it is relavent. Main Points to Make: JSON stands for JavaScript Object Notation On the surface, it is a simple format thats easy for JavaScript to read. In effect, it bridges Javascript and objects. ASP.NET AJAX and Silverlight 1.0 understand JSON. This format is radically different from SOAP. At the time WCF was designed, SOAP was the format of the day. Adapting WCF to work with JSON caused the team to flex their extensibility points. It worked, and now we have support for something wildly different that what WCF was originally intended for. Purpose of this Slide: Describe what JSON is, where it is used, and why it is relavent. Main Points to Make: JSON stands for JavaScript Object Notation On the surface, it is a simple format thats easy for JavaScript to read. In effect, it bridges Javascript and objects. ASP.NET AJAX and Silverlight 1.0 understand JSON. This format is radically different from SOAP. At the time WCF was designed, SOAP was the format of the day. Adapting WCF to work with JSON caused the team to flex their extensibility points. It worked, and now we have support for something wildly different that what WCF was originally intended for.

    10. 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! WCF / AJAX Integration Purpose of this Slide: Describe the full integration between ASP.NET AJAX and WCF. Main Points to Make: WCF is fully supported in the client stack. Project templates, AJAX controls use WCF by default Intellisense picks up Javascript proxy When you add a reference from an ASP.NET AJAX script manager to an svc file, Visual Studio retrieves the Javascript proxy and uses it for Javascript intellisense. The goal is to make developers more efficient You can host a service via an svc file that has the Factory property set to WebScriptServiceHostFactory. Theres no config required. This also works in ASP.NET medium trust, so you can host these kinds of services from anywhere.Purpose of this Slide: Describe the full integration between ASP.NET AJAX and WCF. Main Points to Make: WCF is fully supported in the client stack. Project templates, AJAX controls use WCF by default Intellisense picks up Javascript proxy When you add a reference from an ASP.NET AJAX script manager to an svc file, Visual Studio retrieves the Javascript proxy and uses it for Javascript intellisense. The goal is to make developers more efficient You can host a service via an svc file that has the Factory property set to WebScriptServiceHostFactory. Theres no config required. This also works in ASP.NET medium trust, so you can host these kinds of services from anywhere.

    11. JSON Services

    12. WCF Overview JSON Services HTTP Programming Model Syndication Agenda Purpose of this Slide: Transition to the new WCF API. Specifically, the bottom of the WCF web-centric stack: the HTTP programming model. Purpose of this Slide: Transition to the new WCF API. Specifically, the bottom of the WCF web-centric stack: the HTTP programming model.

    13. 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. Web Concepts (REST) Purpose of this Slide: The REST architectural style has 3 main tenets (on the slide) Main Points to Make: The Web has clearly become pervasive The RESTful architectural style embraces the tenets of the web There are books written about REST, but we think most of it boils down to 3 points: The URI is vital. Segments of a URI can map into an applications logic. HTTP GET is the most important HTTP verb. This is an idempotent request for a representation of some data. We call this a View It operation HTTP <Other> verbs can mean lots of things, but theres usually some action associated with it. We call these types of operations Do It operations Content-Type is the Data Model (as are Accept Headers) Purpose of this Slide: The REST architectural style has 3 main tenets (on the slide) Main Points to Make: The Web has clearly become pervasive The RESTful architectural style embraces the tenets of the web There are books written about REST, but we think most of it boils down to 3 points: The URI is vital. Segments of a URI can map into an applications logic. HTTP GET is the most important HTTP verb. This is an idempotent request for a representation of some data. We call this a View It operation HTTP <Other> verbs can mean lots of things, but theres usually some action associated with it. We call these types of operations Do It operations Content-Type is the Data Model (as are Accept Headers)

    14. The Web, the URI, and Apps Purpose of this Slide: URI structures on the web tend to have holes or templates. Main Points to Make: This concept is going to be familiar to anyone that has built a website, or perhaps even used the web. We need to call special attention to it, because it has special bearing on building services that adhere to the protocols of the web. Contoso has branched into music in addition to their other ventures They want to expose their featured bands or artists as a web service Given the protocols of the web, the topmost box illustrates a reasonable way to build the URI Flaming Hammer is the artist, and their new album is HitMe Northwind is another artist, and their album is Overdone One can model the structure of the URI as artist and album as URI segments subordinate to artists You can do the same thing with query string parameters we see this in the lower box Its the same idea, but placing album in a query string parameter named album Purpose of this Slide: URI structures on the web tend to have holes or templates. Main Points to Make: This concept is going to be familiar to anyone that has built a website, or perhaps even used the web. We need to call special attention to it, because it has special bearing on building services that adhere to the protocols of the web. Contoso has branched into music in addition to their other ventures They want to expose their featured bands or artists as a web service Given the protocols of the web, the topmost box illustrates a reasonable way to build the URI Flaming Hammer is the artist, and their new album is HitMe Northwind is another artist, and their album is Overdone One can model the structure of the URI as artist and album as URI segments subordinate to artists You can do the same thing with query string parameters we see this in the lower box Its the same idea, but placing album in a query string parameter named album

    15. 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 Modeling a URI in .NET 3.5 Purpose of this Slide: Describe some of the types used in WCF in the .NET Framework 3.5 to model URI structures or holes (shown in slide 6). This is one of the fundamental concepts for Web/REST programming. Main Points to Make: There are several new types in the .NET framework that relate to modeling URIs UriTemplate is not strictly part of the WCF API (notice the namespace), but it is the main way we describe the holes in a URI. You can pass a string to the constructor of the UriTemplate that string represents the holes in the URI Once a UriTemplate object is built, you can Bind values to that template and get a URI object back. Likewise, you can take that UriTemplate object and match an existing URI to it and extract the values of the holes It saves developers from having to parse URIs by hand. This has typically been a tedious and very error prone activity. A UriTemplateMatch object is returned from UriTemplate match operations. It provides intelligence about wildcards and relative path segments within a URI The UriTemplateTable type allows you to match a URI against a set of UriTemplate objects. This is the basis for the new dispatching capabilities in WCF in the .NET Framework 3.5Purpose of this Slide: Describe some of the types used in WCF in the .NET Framework 3.5 to model URI structures or holes (shown in slide 6). This is one of the fundamental concepts for Web/REST programming. Main Points to Make: There are several new types in the .NET framework that relate to modeling URIs UriTemplate is not strictly part of the WCF API (notice the namespace), but it is the main way we describe the holes in a URI. You can pass a string to the constructor of the UriTemplate that string represents the holes in the URI Once a UriTemplate object is built, you can Bind values to that template and get a URI object back. Likewise, you can take that UriTemplate object and match an existing URI to it and extract the values of the holes It saves developers from having to parse URIs by hand. This has typically been a tedious and very error prone activity. A UriTemplateMatch object is returned from UriTemplate match operations. It provides intelligence about wildcards and relative path segments within a URI The UriTemplateTable type allows you to match a URI against a set of UriTemplate objects. This is the basis for the new dispatching capabilities in WCF in the .NET Framework 3.5

    16. Roundtrip Data in a URI Purpose of this Slide: Walkthrough how to go from a String, to a URI that contains that String, and back to a String (slide is animated for each line of code). Main Points to Make: Start with a URI object referring to http://localhost, port 2000 Next, instantiate a UriTemplate object, and use the artist/album URI segments we identified earlier Now, we are going to use our existing URI, the template object, and two strings (Northwind and Overdone) to create a new Uri object. This new Uri object is called boundUri and it adheres to the UriTemplate we defined in the previous line. Now that we have a boundUri, lets try to extract the values of artist back out of the boundUri. First, we will call the Match method on the template type, passing the base address, and the boundUri Next, we will find the value of the artist Uri segment via the BoundVariables indexer on the UriTempalteMatch type. The programming model is easy to use Purpose of this Slide: Walkthrough how to go from a String, to a URI that contains that String, and back to a String (slide is animated for each line of code). Main Points to Make: Start with a URI object referring to http://localhost, port 2000 Next, instantiate a UriTemplate object, and use the artist/album URI segments we identified earlier Now, we are going to use our existing URI, the template object, and two strings (Northwind and Overdone) to create a new Uri object. This new Uri object is called boundUri and it adheres to the UriTemplate we defined in the previous line. Now that we have a boundUri, lets try to extract the values of artist back out of the boundUri. First, we will call the Match method on the template type, passing the base address, and the boundUri Next, we will find the value of the artist Uri segment via the BoundVariables indexer on the UriTempalteMatch type. The programming model is easy to use

    17. Simple URI-to-application mapping URIs in WCF Contracts Purpose of this Slide: Introduce how the UriTemplating shown in the previous slides surfaces to the developer the WebGetAttribute and the WebInvokeAttribute have an instance property named UriTemplate. Main Points to Make: UriTemplate objects are flexible and powerful, but we wanted to make it easier to use. To that end, we surfaced the UriTemplate functionality through a model already familiar to WCF developers the operation contract Dont get too distracted by the WebGet attribute we will talk more about that a bit later. For now, focus on the UriTemplate instance property of the WebGet annotation. The string value of this property gets passed to the ctor of a UriTemplate object at runtime. Notice that the names inside the {} map to the names of arguments in the interface methods. This is how WCF does the mapping internally. Also notice that you can use strict Uri segments or query strings. In essence, you have full flexibility in defining how the Uri gets mapped to application semantics. It is our hope that this model makes modeling the URI a breeze. Purpose of this Slide: Introduce how the UriTemplating shown in the previous slides surfaces to the developer the WebGetAttribute and the WebInvokeAttribute have an instance property named UriTemplate. Main Points to Make: UriTemplate objects are flexible and powerful, but we wanted to make it easier to use. To that end, we surfaced the UriTemplate functionality through a model already familiar to WCF developers the operation contract Dont get too distracted by the WebGet attribute we will talk more about that a bit later. For now, focus on the UriTemplate instance property of the WebGet annotation. The string value of this property gets passed to the ctor of a UriTemplate object at runtime. Notice that the names inside the {} map to the names of arguments in the interface methods. This is how WCF does the mapping internally. Also notice that you can use strict Uri segments or query strings. In essence, you have full flexibility in defining how the Uri gets mapped to application semantics. It is our hope that this model makes modeling the URI a breeze.

    18. All HTTP verbs are first class citizens GET, POST, PUT, etc. View It vs Do It separation mimics web HTTP Verbs in WCF Contracts Purpose of this Slide: Show how the WCF API surfaces the HTTP verbs to developers. Main Points to Make: Remember our 4 tenets of the web: embrace the URI, HTTP GET is special, and Content-Type is the data model. Now that we have seen how to model a Uri in WCF, lets see how HTTP GETs and other HTTP verbs surface to the developer As weve seen, there are at least 8 HTTP verbs, and they can be broadly categorized into two groups: View it and Do it. ViewIt == HTTP GET, DoIt == all others ViewIt operations surface through the WebGetAttribute annotation. DoIt operations surface through the WebInvokeAttribute annotation. We called these out as separate since HTTP GET is special. The WebInvoke attribute includes a METHOD instance property. We can set the value of that property to the HTTP verb that will access that method. Notice that the WebInvoke allows you to pass a complex data type to the method. Purpose of this Slide: Show how the WCF API surfaces the HTTP verbs to developers. Main Points to Make: Remember our 4 tenets of the web: embrace the URI, HTTP GET is special, and Content-Type is the data model. Now that we have seen how to model a Uri in WCF, lets see how HTTP GETs and other HTTP verbs surface to the developer As weve seen, there are at least 8 HTTP verbs, and they can be broadly categorized into two groups: View it and Do it. ViewIt == HTTP GET, DoIt == all others ViewIt operations surface through the WebGetAttribute annotation. DoIt operations surface through the WebInvokeAttribute annotation. We called these out as separate since HTTP GET is special. The WebInvoke attribute includes a METHOD instance property. We can set the value of that property to the HTTP verb that will access that method. Notice that the WebInvoke allows you to pass a complex data type to the method.

    19. 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 Data Formats and the Web Purpose of this Slide: Content-Type header is the vehicle for expressing data formats on the web Main Points to Make: HTTP Headers can express anything (caching, language, data format, browser type, etc.) There are two different headers for data format. One on the client, another from the server The client (or requestor) can use the HTTP accept header to indicate what types of content they want to receive. The server (or response) can use the HTTP Content-Type header to indicate what type of content they are returning The possibilities are MIME types and they have a 2 part syntax: <type>/<sub-type>. As we see in the slide, type can mean text, images, application data, video, etc. A sub-type can be html, css, image formats, etc. There are lots of registered MIME types at www.IANA.org. Purpose of this Slide: Content-Type header is the vehicle for expressing data formats on the web Main Points to Make: HTTP Headers can express anything (caching, language, data format, browser type, etc.) There are two different headers for data format. One on the client, another from the server The client (or requestor) can use the HTTP accept header to indicate what types of content they want to receive. The server (or response) can use the HTTP Content-Type header to indicate what type of content they are returning The possibilities are MIME types and they have a 2 part syntax: <type>/<sub-type>. As we see in the slide, type can mean text, images, application data, video, etc. A sub-type can be html, css, image formats, etc. There are lots of registered MIME types at www.IANA.org.

    20. WebOperationContext.Current provides access to incoming request headers Can also set outgoing response headers Some are shortcut for easier use Specifying Data Format in WCF Purpose of this Slide: Show how to specify the Content-Type HTTP header. Main Points to Make: You set the content-type from within the methods in the service object. In more concrete terms, this is the type that implements your service contract. The API follows the experience introduced in .NET 3.0: You can access the HTTP headers through the WebOperationContext.Current property. .NET 3.0 had the OperationContext.Current and provided access to SOAP headers in the incoming and outgoing messages The Content-Type header, because of its significance in the web world, is called out specially. If you want access to other headers, they are available in a collection. The Content-Type property is of type String, so you can set its value to any MIME type you choose. Purpose of this Slide: Show how to specify the Content-Type HTTP header. Main Points to Make: You set the content-type from within the methods in the service object. In more concrete terms, this is the type that implements your service contract. The API follows the experience introduced in .NET 3.0: You can access the HTTP headers through the WebOperationContext.Current property. .NET 3.0 had the OperationContext.Current and provided access to SOAP headers in the incoming and outgoing messages The Content-Type header, because of its significance in the web world, is called out specially. If you want access to other headers, they are available in a collection. The Content-Type property is of type String, so you can set its value to any MIME type you choose.

    21. 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! Hosting / Binding Purpose of this Slide: Describe how easy it is to host a service that adheres to the protocols of the web Main Points to Make: The .NET framework 3.5 introduces a new Binding (WebHttpBinding) that encompasses the messaging semantics of the web. As per the .NET 3.0 paradigm, you can add a new endpoint to an existing ServiceHost object using this Binding, and you are ready to listen. Theres another step, though. You have to add the WebHttpBehavior to the endpoint. This sets up the right dispatching infrastructure. You dont have to add that behavior if you use the new WebServiceHost, and WebServiceHostFactory types. These types add the right behavior automatically. You can use these serviceHost/Factory types and you dont need any config code Its important to note that these endpoints do not support WSDL. There just isnt a widely accepted way to express these kinds of endpoints in the current incarnation of WSDL. To top it off, this functionality works in ASP.NET medium trust, so you can host these endpoints practically anywhere (a big hoster, default ASP.NET setups, etc.)Purpose of this Slide: Describe how easy it is to host a service that adheres to the protocols of the web Main Points to Make: The .NET framework 3.5 introduces a new Binding (WebHttpBinding) that encompasses the messaging semantics of the web. As per the .NET 3.0 paradigm, you can add a new endpoint to an existing ServiceHost object using this Binding, and you are ready to listen. Theres another step, though. You have to add the WebHttpBehavior to the endpoint. This sets up the right dispatching infrastructure. You dont have to add that behavior if you use the new WebServiceHost, and WebServiceHostFactory types. These types add the right behavior automatically. You can use these serviceHost/Factory types and you dont need any config code Its important to note that these endpoints do not support WSDL. There just isnt a widely accepted way to express these kinds of endpoints in the current incarnation of WSDL. To top it off, this functionality works in ASP.NET medium trust, so you can host these endpoints practically anywhere (a big hoster, default ASP.NET setups, etc.)

    22. View It and Do It

    23. Level-set JSON Services HTTP Programming Model Syndication Agenda Purpose of this Slide: Introduce the syndication capabilities of WCF in the .NET Framework 3.5 Main Points to Make: At last, we finally have a single place to go for creating and consuming syndicated content. No more 3rd party tools or unsupported plugins.Purpose of this Slide: Introduce the syndication capabilities of WCF in the .NET Framework 3.5 Main Points to Make: At last, we finally have a single place to go for creating and consuming syndicated content. No more 3rd party tools or unsupported plugins.

    24. 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 Goals in .NET 3.5 Purpose of this Slide: Syndications can represent more than just news and blogs, and the .NET Framework now has 1st class support for creating and consuming syndications. Main Points to Make: In the abstract, a syndication is a way to represent a set of data. Purchase Orders, Documents, etc. Usually the data represented does not change once in place (at least not frequently) The two major syndication formats are RSS and ATOM. Their structure is similar, but different. The .NET Framework had to shield developers from the eccentricities of each format, and we did that by creating types that can encode as either format. Feeds had to fit within the model of existing WCF applications, but syndication in the broad sense could not be dependant on WCF. When hosting or consuming a feed with WCF, a feed is just a service operation. You work with it as you would other services. You can also use syndications in a standalone fashion, where you treat a syndication as an XML document. Purpose of this Slide: Syndications can represent more than just news and blogs, and the .NET Framework now has 1st class support for creating and consuming syndications. Main Points to Make: In the abstract, a syndication is a way to represent a set of data. Purchase Orders, Documents, etc. Usually the data represented does not change once in place (at least not frequently) The two major syndication formats are RSS and ATOM. Their structure is similar, but different. The .NET Framework had to shield developers from the eccentricities of each format, and we did that by creating types that can encode as either format. Feeds had to fit within the model of existing WCF applications, but syndication in the broad sense could not be dependant on WCF. When hosting or consuming a feed with WCF, a feed is just a service operation. You work with it as you would other services. You can also use syndications in a standalone fashion, where you treat a syndication as an XML document.

    25. 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 in .NET Fx 3.5 Purpose of this Slide: Syndication API is an easy-to-use, flexible, format-agnostic way to create and consume syndications. Main Points to Make: The API supports all major RSS and ATOM constructs It allows the user to consume RSS or ATOM feeds normalizing feeds is a much bigger job than creating and exposing feeds. The OM is easy to use, and follows the XML object model from the .NET Framework. Syndications are normally interacted with over HTTP, but the Syndication API is transport agnostic, so you can use Syndications over practically any transport. The syndication API supports several loosely typed and strongly typed extensions. The API is also format agnostic you are shielded from the eccentricities of the different syndication formats. Purpose of this Slide: Syndication API is an easy-to-use, flexible, format-agnostic way to create and consume syndications. Main Points to Make: The API supports all major RSS and ATOM constructs It allows the user to consume RSS or ATOM feeds normalizing feeds is a much bigger job than creating and exposing feeds. The OM is easy to use, and follows the XML object model from the .NET Framework. Syndications are normally interacted with over HTTP, but the Syndication API is transport agnostic, so you can use Syndications over practically any transport. The syndication API supports several loosely typed and strongly typed extensions. The API is also format agnostic you are shielded from the eccentricities of the different syndication formats.

    26. Syndication Contracts in WCF Purpose of this Slide: Describe how the syndication API surfaces as per the normal WCF paradigm Main Points to Make: The code above illustrates how to return a syndication from a WCF service. Notice it is an operation annotated with the OperationContractAttribute. Weve also added the WebGetAttribute annotation and specified the URL the feed will be available at. Notice the format argument to the Feed method This will be used to indicate if we want to return RSS or ATOM. Notice the return type of the method. SyndicationFeedFormatter is a type that can take a feed and transform it into a particular format. the API ships with two SyndicationFeedFormatter derived types: Atom10FeedFormatter and RSS20FeedFormatter Since we might be returning either, we need to add the ServiceKnownTypeAttributeAnnotation. Normal WCF in .NET 3.0 construct. Purpose of this Slide: Describe how the syndication API surfaces as per the normal WCF paradigm Main Points to Make: The code above illustrates how to return a syndication from a WCF service. Notice it is an operation annotated with the OperationContractAttribute. Weve also added the WebGetAttribute annotation and specified the URL the feed will be available at. Notice the format argument to the Feed method This will be used to indicate if we want to return RSS or ATOM. Notice the return type of the method. SyndicationFeedFormatter is a type that can take a feed and transform it into a particular format. the API ships with two SyndicationFeedFormatter derived types: Atom10FeedFormatter and RSS20FeedFormatter Since we might be returning either, we need to add the ServiceKnownTypeAttributeAnnotation. Normal WCF in .NET 3.0 construct.

    27. Syndication with PictureServices

    28. Simple HTTP service development SOAP and POX from the same contract JSON messaging capability Simple syndication really! Web Centric Features in WCF 3.5 Purpose of this Slide: WCF in the .NET Framework 3.5 has 1st class support for building applications that adhere to the protocols of the web. Main Points to Make: WCF in the .NET Framework 3.5 has several enhancements, certainly more than are on this slide Its important to note that all of the WCF enhancements in the .NET Framework 3.5 are built on .NET 3.0 extension points (WCF extensions) This is viewed internally as a validation of the .NET 3.0 architecture The web-centric features of WCF were driven around 5 goals: Services that adhere to the protocols of the web had to be easy to write The contract for these types of services had to be compatible with contracts from .NET 3.0 (WEB contracts have some unique requirements) JSON had to be fully supported The features had to expose HTTP optimizations like Caching in a simple and easy to use experience Creating and consuming syndications had to be easy Purpose of this Slide: WCF in the .NET Framework 3.5 has 1st class support for building applications that adhere to the protocols of the web. Main Points to Make: WCF in the .NET Framework 3.5 has several enhancements, certainly more than are on this slide Its important to note that all of the WCF enhancements in the .NET Framework 3.5 are built on .NET 3.0 extension points (WCF extensions) This is viewed internally as a validation of the .NET 3.0 architecture The web-centric features of WCF were driven around 5 goals: Services that adhere to the protocols of the web had to be easy to write The contract for these types of services had to be compatible with contracts from .NET 3.0 (WEB contracts have some unique requirements) JSON had to be fully supported The features had to expose HTTP optimizations like Caching in a simple and easy to use experience Creating and consuming syndications had to be easy

    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 Smiths Blog http://blogs.msdn.com/justinjsmith/ Steve Maines Blog http://hyperthink.net/blog/ Getting Started with WCF http://msdn2.microsoft.com/en-us/vbasic/bb736015.aspx

More Related