About - Microsoft

Download Report

Transcript About - Microsoft

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 / POX vs. SOAP
– GET vs. POST, PUT & DELETE
– Cache
– URI Template
• ADO.NET Data Services ( LINQ to URL )
About
• Consulting
• Mentoring
• Projects
Web Services Everywhere…
You know how it starts,
But you don’t know
how it ends !!!
Web Services Customizations
HTTP Communication
Verb
Headers
URL
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
...
Data
XML, JSON, SOAP, AtomPub ...
JSON vs. SOAP
Verb
Headers
Data
URL
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
...
<Envelope>
{
<Header>
"Age":37,
<!–- Headers -->
"FirstName":"Eyal",
<!-- Protocol's & Polices -->
"ID":"123",
</Header>
"LastName":"Vardi“
<Body>
}
<!– XML Data -->
</Body>
</Envelope>
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
JS Proxy
URI Template
Config
WebMethod
ScriptMethod
NO
NO
WCF Solutions ( WebGet , WebInvoke )
DEMO
Web Service ( WCF ) Customization
ASMX vs. WCF
Options
Data
Verbs
Headers
Help Page
Description
Cache
ASMX
XML , JSON
POST, GET


WebMethod
WebMethod
WCF
XML , JSON
GET, POST, HEAD…

NO
NO
Headers
JS Proxy
ScriptMethod
Yes / NO
URI Template
Config
NO
NO
Yes
NO / Yes
DEMO
WCF Dynamic Format ( XML or JSON )
Client Caching
• The request doesn’t get to the server, unless the
data is expires.
HTTP Response
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
Server Caching
Request
HTTP
Response
Browser
304 Status
HTTP/1.1
304 Not Modified
GET
E4D/Demos/Test.svc
HTTP/1.1
Cache-Control
: no-cache
If-Modified-Since:
16/11/2008 23:58:13
Cache-Control:
no-cache
Expires
Sun,
16 Nov 2008 11:58:18 GT11
Etag
: d06606c5-7fab-46f0-a5cd-6f911e3e51eb
Connection: :Close
DEMO
Server Caching
ASP.NET Server Caching
Request
Browser
Response
 SQL Dependency
 Duration
 Vary By Param
DEMO
ASP.NET Server Caching
ADO.NET Data Services
LINQ to URL
LINQ to URL
Win App
or
Browser
from x in Products
where x.ID > 555
select x.Name
AtomPub
 Data Service
 IQuerable<T>
Services Platform
Application / Service
Data
Services
WCF
System.Net
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 Siwek
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.