Web Service Programming with WCF 3.5 Eyal Vardi CEO E4D Solutions LTD Microsoft MVP Visual C# blog: www.eVardi.com
Agenda Web Services Future (Cloud Computing) Web Services Customizations with .NET 3.5 JSON vs. SOAP GET vs. POST Cache  URI Template ADO.NET Data Services ( LINQ to URL )
About Me Consulting Mentoring Projects
Web Services Everywhere…
You know how it starts, But you don’t know how it ends !!!
Web Services Customizations
HTTP Communication POST  SimpleService.asmx/EchoString HTTP/1.1 Host:    localhost:1489 User-Agent:  Mozilla/5.0  Accept:  text/html Content-Type:  application/json; Content-Length: 27 ... XML, JSON, SOAP, AtomPub ... Headers Data Verb URL
JSON vs. SOAP POST SimpleService.asmx/EchoString HTTP/1.1 Host: localhost:1489 User-Agent: Mozilla/5.0  Accept: text/html,application/xhtml+xml Content-Type: application/json; Content-Length: 27 ... { &quot;Age&quot;:37, &quot;FirstName&quot;:&quot;Eyal&quot;, &quot;ID&quot;:&quot;123&quot;, &quot;LastName&quot;:&quot;Vardi“ } <Envelope> <Header> <!–- Headers --> <!-- Protocol's & Polices --> </Header> <Body> <!– XML Data --> </Body> </Envelope> Headers Data Verb URL
Before WCF ( ASMX )
DEMO Web Service ( ASMX ) Customization
ASMX HTTP Options Options ASMX Data SOAP,  XML,  JSON ,  {arg}={value} Verbs POST,  GET Headers Help Page Description  WebMethod  Cache WebMethod  JS Proxy ScriptMethod  URI Template NO Config NO
ASMX HTTP Options ScriptMethod – Create on the fly JS Proxy. WebMethod  – Cache, Description & Session  Data Verb Headers URL XML JSOM GET POST X
WCF Solutions  ( WebGet , WebInvoke )
DEMO Web Service ( WCF ) Customization
ASMX vs. WCF Options ASMX WCF Data XML , JSON XML , JSON Verbs POST,  GET GET, POST, HEAD… Headers Help Page NO Description  WebMethod  NO Cache WebMethod  Headers JS Proxy ScriptMethod  Yes / NO URI Template NO Yes Config NO NO / Yes
DEMO WCF Dynamic Format ( XML or JSON )
Client Caching The request doesn’t get to the server, unless the data is expires. Browser GET  E4D/Demos/Test.svc  HTTP/1.1 Cache-Control : private | max-age=5 | no-cache Expires  :  Sun, 16 Nov 2008 11:58:18 GT11 HTTP Response
Server Caching Request 304 Status Browser GET  E4D/Demos/Test.svc  HTTP/1.1 If-Modified-Since: 16/11/2008 23:58:13 Etag  : d06606c5-7fab-46f0-a5cd-6f911e3e51eb HTTP/1.1 304 Not Modified Cache-Control: no-cache Connection: Close HTTP Response GET  E4D/Demos/Test.svc  HTTP/1.1 Cache-Control : no-cache Expires  :  Sun, 16 Nov 2008 11:58:18 GT11
DEMO Server Caching
ASP.NET Server Caching Request Response Browser SQL Dependency Duration Vary By Param
DEMO ASP.NET Server Caching
ADO.NET Data Services
LINQ to URL LINQ to URL AtomPub Win App or Browser Data Service IQuerable<T> from x in Products where x.ID > 555 select x.Name
Services Platform System.Net WCF Data Services Application / Service
DEMO Data Services Hello World
Summary Get the MAX from the HTTP 1.1 Caching SOAP vs. JSON ADO.NET Data Services
Additional Resources http://www.eVardi.com  , My blog. WCF REST Starter Kit HTTP Protocol (RFC2616) WCF Web Programming Model Overview
Related Sessions DEV401: ASP.NET Ajax Internals Dan Amiga 09:00 – 10:30 DEV309: Building Web Sites with ASP.NET MVC  Noam King 16:00 – 17:10  ARC301: “Velocity”  Yair 16:00 – 17:10
© 2008 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.

DEV301- Web Service Programming with WCF 3.5

  • 1.
    Web Service Programmingwith WCF 3.5 Eyal Vardi CEO E4D Solutions LTD Microsoft MVP Visual C# blog: www.eVardi.com
  • 2.
    Agenda Web ServicesFuture (Cloud Computing) Web Services Customizations with .NET 3.5 JSON vs. SOAP GET vs. POST Cache URI Template ADO.NET Data Services ( LINQ to URL )
  • 3.
    About Me ConsultingMentoring Projects
  • 4.
  • 5.
    You know howit starts, But you don’t know how it ends !!!
  • 6.
  • 7.
    HTTP Communication POST SimpleService.asmx/EchoString HTTP/1.1 Host: localhost:1489 User-Agent: Mozilla/5.0 Accept: text/html Content-Type: application/json; Content-Length: 27 ... XML, JSON, SOAP, AtomPub ... Headers Data Verb URL
  • 8.
    JSON vs. SOAPPOST SimpleService.asmx/EchoString HTTP/1.1 Host: localhost:1489 User-Agent: Mozilla/5.0 Accept: text/html,application/xhtml+xml Content-Type: application/json; Content-Length: 27 ... { &quot;Age&quot;:37, &quot;FirstName&quot;:&quot;Eyal&quot;, &quot;ID&quot;:&quot;123&quot;, &quot;LastName&quot;:&quot;Vardi“ } <Envelope> <Header> <!–- Headers --> <!-- Protocol's & Polices --> </Header> <Body> <!– XML Data --> </Body> </Envelope> Headers Data Verb URL
  • 9.
  • 10.
    DEMO Web Service( ASMX ) Customization
  • 11.
    ASMX HTTP OptionsOptions ASMX Data SOAP, XML, JSON , {arg}={value} Verbs POST, GET Headers Help Page Description WebMethod Cache WebMethod JS Proxy ScriptMethod URI Template NO Config NO
  • 12.
    ASMX HTTP OptionsScriptMethod – Create on the fly JS Proxy. WebMethod – Cache, Description & Session Data Verb Headers URL XML JSOM GET POST X
  • 13.
    WCF Solutions ( WebGet , WebInvoke )
  • 14.
    DEMO Web Service( WCF ) Customization
  • 15.
    ASMX vs. WCFOptions ASMX WCF Data XML , JSON XML , JSON Verbs POST, GET GET, POST, HEAD… Headers Help Page NO Description WebMethod NO Cache WebMethod Headers JS Proxy ScriptMethod Yes / NO URI Template NO Yes Config NO NO / Yes
  • 16.
    DEMO WCF DynamicFormat ( XML or JSON )
  • 17.
    Client Caching Therequest doesn’t get to the server, unless the data is expires. Browser GET E4D/Demos/Test.svc HTTP/1.1 Cache-Control : private | max-age=5 | no-cache Expires : Sun, 16 Nov 2008 11:58:18 GT11 HTTP Response
  • 18.
    Server Caching Request304 Status Browser GET E4D/Demos/Test.svc HTTP/1.1 If-Modified-Since: 16/11/2008 23:58:13 Etag : d06606c5-7fab-46f0-a5cd-6f911e3e51eb HTTP/1.1 304 Not Modified Cache-Control: no-cache Connection: Close HTTP Response GET E4D/Demos/Test.svc HTTP/1.1 Cache-Control : no-cache Expires : Sun, 16 Nov 2008 11:58:18 GT11
  • 19.
  • 20.
    ASP.NET Server CachingRequest Response Browser SQL Dependency Duration Vary By Param
  • 21.
  • 22.
  • 23.
    LINQ to URLLINQ to URL AtomPub Win App or Browser Data Service IQuerable<T> from x in Products where x.ID > 555 select x.Name
  • 24.
    Services Platform System.NetWCF Data Services Application / Service
  • 25.
    DEMO Data ServicesHello World
  • 26.
    Summary Get theMAX from the HTTP 1.1 Caching SOAP vs. JSON ADO.NET Data Services
  • 27.
    Additional Resources http://www.eVardi.com , My blog. WCF REST Starter Kit HTTP Protocol (RFC2616) WCF Web Programming Model Overview
  • 28.
    Related Sessions DEV401:ASP.NET Ajax Internals Dan Amiga 09:00 – 10:30 DEV309: Building Web Sites with ASP.NET MVC Noam King 16:00 – 17:10 ARC301: “Velocity” Yair 16:00 – 17:10
  • 29.
    © 2008 MicrosoftCorporation. 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.