1 / 35

WCF The Unified Services Programming Model for SOAP, REST, Data and RIA Communication

WCF The Unified Services Programming Model for SOAP, REST, Data and RIA Communication. Ron Jacobs Sr. Program Manager, AppFabric Development Platform (WCF/WF) Microsoft Corporation http://blogs.msdn.com/rjacobs @ ronljacobs. What you wanted. What you got. What you need. WCF.

magdalene
Download Presentation

WCF The Unified Services Programming Model for SOAP, REST, Data and RIA Communication

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. WCF The Unified Services Programming Model for SOAP, REST, Data and RIA Communication Ron Jacobs Sr. Program Manager, AppFabric Development Platform (WCF/WF) Microsoft Corporation http://blogs.msdn.com/rjacobs @ronljacobs

  2. What you wanted

  3. What you got

  4. What you need

  5. WCF Programming Model SOAPServices Web HTTP Services Data Services RIA Services Workflow Services Service Model Data Contract Service Contract Service Behavior Channel Model Formats (Atom, JSON, XML,…) Transports (HTTP, TCP, …) Protocols (SOAP, HTTP, Open Data Protocol,…)

  6. WCF Programming Model SOAPServices Web HTTP Services Data Services RIA Services Workflow Services Service Model Data Contract Service Contract Service Behavior Channel Model Formats (Atom, JSON, XML,…) Transports (HTTP, TCP, …) Protocols (SOAP, HTTP, Open Data Protocol,…)

  7. WCF SOAP Services (made easy in .NET 4) demo

  8. WCF Programming Model SOAPServices Web HTTP Services Data Services RIA Services Workflow Services Service Model Data Contract Service Contract Service Behavior Channel Model Formats (Atom, JSON, XML,…) Transports (HTTP, TCP, …) Protocols (SOAP, HTTP, Open Data Protocol,…)

  9. WCF Workflow Services http://channel9.msdn.com/Shows/Endpoint/endpointtv-WF4--AppFabric-Contoso-HR-Sample demo

  10. WCF Programming Model SOAPServices Web HTTP Services Data Services RIA Services Workflow Services Service Model Data Contract Service Contract Service Behavior Channel Model Formats (Atom, JSON, XML,…) Transports (HTTP, TCP, …) Protocols (SOAP, HTTP, Open Data Protocol,…)

  11. Model

  12. Service publicclassConference: DataService<ConferenceDataEntities> { // This method is called only once to initialize service-wide policies. publicstaticvoidInitializeService(DataServiceConfigurationconfig) { config.SetEntitySetAccessRule("*", EntitySetRights.AllRead); config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2; } }

  13. WCF Data Services http://bit.ly/bTKZNz demo

  14. WCF Programming Model SOAPServices Web HTTP Services Data Services RIA Services Workflow Services Service Model Data Contract Service Contract Service Behavior Channel Model Formats (Atom, JSON, XML,…) Transports (HTTP, TCP, …) Protocols (SOAP, HTTP, Open Data Protocol,…)

  15. Three Steps to build a WebHttp Service

  16. Resource publicclassSessionData { publicint ID { get; set; } publicstring Title { get; set; } publicDateTime? Date { get; set; } publicstring Speaker { get; set; } }

  17. Three Steps to build a WebHttp Service

  18. Resource URI

  19. Three Steps to build a WebHttp Service

  20. Step 1 – Create Service • public class Session • { • public SessionData[] GetSessions(int start, int count) • { • } • public SessionData GetSession(string id) • { • } • }

  21. Step 2 – Implement Service • public class Session • { • public SessionData[] GetSessions(int start, int count) • { • return ConferenceRepository.GetSessions(start, count); • } • public SessionDataGetSession(string id) • { • return ConferenceRepository.GetSession(id); • } • }

  22. Step 3 – Attribute for WCF • [ServiceContract] • [AspNetCompatibilityRequirements( • RequirementsMode = AspNetCompatibilityRequirementsMode.Required)] • public class Session • { • }

  23. Step 3 – Attribute for WCF • [WebGet] • public SessionDataGetSession(string id) • { • return ConferenceRepository.GetSession(id); • } HTTP GET = “~/Sessions/GetSession?id=123”

  24. Step 3 – Attribute for WCF • [WebGet(UriTemplate = "/{id}")] • public SessionDataGetSession(string id) • { • return ConferenceRepository.GetSession(id); • } HTTP GET = “~/Sessions/123”

  25. Step 3 – Attribute for WCF • [WebGet(UriTemplate = "/?skip={skip}&take={take}")] • public SessionData[] GetSessions(int skip, int take) • { • return ConferenceRepository.GetSessions( • AdjustSkip(skip), • AdjustTake(take)); • } HTTP GET = “~/Sessions?skip=5&take=7”

  26. Step 4 – Add Routes • void Application_Start(object sender, EventArgs e) • { • RouteTable.Routes.Add( • new ServiceRoute("Sessions", • new WebServiceHostFactory(), • typeof(SessionService))); • } No .SVC file!

  27. Step 5 – Configure <system.serviceModel> <standardEndpoints> <webHttpEndpoint> <standardEndpoint automaticFormatSelectionEnabled="true" helpEnabled="true" /> </webHttpEndpoint> </standardEndpoints> <serviceHostingEnvironmentaspNetCompatibilityEnabled="true" /> </system.serviceModel>

  28. WCF WebHTTP Services http://code.msdn.microsoft.com/WebHTTPAPIKey demo

  29. Canonical REST Entity Service http://code.msdn.microsoft.com/cannonicalRESTEntity demo

  30. Talk to us • http://facebook.com/AppFabric • Twitter: @appfabric, @ronljacobs • Email: appfabric@microsoft.com

  31. Podcasts • http://endpoint.tv • Coming soon • AppFabric Radio • Dialog with us live • Twitter • Facebook • Email

  32. Q&A • New WCF HTTP bits available on CodePlex • ASI201-LNC - Windows Workflow Foundation Futures • Thursday Lunch 1:20p • Stay Informed • http://endpoint.tv – our video podcast • http://blogs.msdn.com/endpoint - team blog • http://blogs.msdn.com/rjacobs - my blog • http://msdn.microsoft.com/wcf - WCF Developer Center • http://wcf.codeplex.com – WCF on CodePlex • @appfabric, @ronljacobs – Twitter / Facebook

  33. Session Evaluations Tell us what you think, and you could win! All evaluations submitted are automatically entered into a daily prize draw*  Sign-in to the Schedule Builder at http://europe.msteched.com/topic/list/ * Details of prize draw rules can be obtained from the Information Desk.

  34. © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

More Related