wcf from the web developer
TRANSCRIPT
WCF for the web developer
Florin Cardașim, [email protected]: @cardasim, @CodeCampIasiRomSoft, www.rms.ro
Iași, 8th of May 2010
Agenda
WCF today: an overview
WCF Services for the WEB 2.0
SOAP & REST
WCF Data Services
WCF Today
Channel ModelFormats
(XML, JSON, Atom…)
Transports(HTTP, TCP, IPC,
MSMQ…)
Protocols(SOAP, HTTP, Open Data Protocol,…)
Service Model
Data Contract
Service Contract
Service Behavior
Programming ModelSOAP
Services
WEB HTTP
Services
Data Service
s
RIA Service
s
Workflow
Services
WCF Architecture - Channels
Channel A
Transport Channel
WCF Service
HTTP, TCP, MSMQ, etc.
Channel B
Channel C
WCF Client
Channel A
Transport Channel
Channel B
Channel C
WCF Architecture - Bindings
Binding 3
Binding 1
Transport HTTP
WCF Service
Binding 2Transacti
ons
Transport HTTP
Security
Transport TCP
RM
Security
[ServiceContract]interface IExampleB{ . . .}
[ServiceContract]interface IExampleA{ . . .}
Transactions
Demo: WCF Services for the WEB 2.0
Service type WCF classes Client
SOAP 1.2 WSHttpBinding, ServiceHost C# client, No Ajax
SOAP 1.1 BasicHttpBinding, ServiceHost Java Script XMLHttpRequest
POX WebHttpBinding, WebServiceHostFactory,WebMessageFormat.Xml
Java Script XMLHttpRequest
JSON WebHttpBinding, WebServiceHostFactory,WebMessageFormat.Json
Java Script XMLHttpRequest
JSON, proxy enabled WebHttpBinding, WebScriptServiceHostFactory
Java Script,asp:ScriptManagerScriptManager(XMLHttpRequest)
What is SOAPSOAP = Simple(?!!) Object Access Protocol
=protocol, =standards
advanced features: security, reliable messaging, transactions
transport neutrality (http, tcp, ipc, msmq …)uses POST when used over HTTP
roots in enterprise applications
SOAP-HTTP bindingswsHttpBindin
gSOAP 1.2
Reliable Session
Symmetric Security
Transaction Flow
HTTP Transport
(Text Message Encoding)
basicHttpBinding
SOAP 1.1
HTTP Transport
(Text Message Encoding)
SOAP & WS-*
Transport: HTTP/S, TCP, SMTP, UDP…
XML: XML, XSD, Digital Signature, Encryption
Messaging: SOAP, Addressing, MTOM, Transfer, Discovery…
MEXPolic
yWSD
L
SEC: Kerberos,
Username, X.509, SAML
Secure Conversation,
Federation, Trust
RM:Reliability, Reliable Messagin
g
TRAN:Bussiness
Act,Atomic,
Coordination
A SOAP request
Account 1
Account 2
Account 3
WCF Client
WCF Service
POST /AccountAccess/Accounts.svcHost: www.quickbank.comSOAPAction: GetBalance…<soap:Envelope xmlns:soap= … <soap:Body> <GetBalance xmlns= … <Account>2</Account> </GetBalance> </soap:Body></soap:Envelope>
What is RESTREST = REpresentational State Transfer ! protocol, ! format, ! standard= architectural style
everything is a resource: Account, Balance …
address: www.quickbank.com/Accounts/2 uniform interface: HTTP GET, POST, PUT, DELETE
roots in WEB facing services (for example Google Search)
A REST request
GET www.quickbank.com/Accounts/2
WCF Client
WCF Service
Account 1
Account 2
Account 3
Demo: Twitter REST Service
webHttpBindingHTTP
Transport (Web
Message Encoding)
Formats:XML, JSONRSS, ATOM
SOAP & RESTSOAP/WS-* REST
Invoking Operations SOAP HTTP
Transport protocol HTTP, TCP … HTTP
Service description WSDL No standard
Send Security Tokens WS-Security HTTP, SSL
Receive Security Tokens WS-Trust No standard
Security Context WS-SecureConversation SSL
End-to-end reliability WS-ReliableMesaging No standard
Distributed Transactions WS-AtomicTransaction, WS-Coordintation
No standard
Defining policy WS-Policy No standard
Metadata WS-MetadataExchange No standard
When to SOAP? When to REST?
Exposing data OR operations?Need for WS-*?Who will be using your service?What are you/your developers comfortable with?
REST seems to be preferred in the clouds: Amazon S3Windows AzureGoogle…
OData: WCF Data ServicesOpen Data Protocol
REST-based protocol for CRUD-style operations
Based on AtomPubFormats: Atom, Xml, JSON
DEMO
OData: Existing clients and serversClients
Browser .NET 3.5, 4.0 Java Script Java Restlet 2.0PHPASP.NET AJAXExcel 2010 Power Pivot
LINQPad
ServersSQL AzureSharePoint 2010SQL Reporting Services
IBM WebSphereYour WCF Data Service
ResourcesAaron Skonnard, www.pluralsight.comDavid Chappel, www.davidchappel.com
http://wildermuth.comMichele Bustamante, www.thatindigogirl.com
MSDN REST Starter Kit
Please fill the evaluation form
Thank you very much!Florin Cardașim, [email protected]: @cardasim, @CodeCampIasiRomSoft, www.rms.ro
Iași, 8th of May 2010
Demo: REST in .NET 4.0CachingAutomatic format selectionREST Starter Kit:
Client API Paste as Xml