wcf from the web developer

20
WCF for the web developer Florin Cardașim, [email protected] twitter: @cardasim, @CodeCampIasi RomSoft, www.rms.ro Iași, 8 th of May 2010

Upload: florin-cardasim

Post on 12-May-2015

789 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: WCF from the web developer

WCF for the web developer

Florin Cardașim, [email protected]: @cardasim, @CodeCampIasiRomSoft, www.rms.ro

Iași, 8th of May 2010

Page 2: WCF from the web developer

Agenda

WCF today: an overview

WCF Services for the WEB 2.0

SOAP & REST

WCF Data Services

Page 3: WCF from the web developer

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

Page 4: WCF from the web developer

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

Page 5: WCF from the web developer

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

Page 6: WCF from the web developer

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)

Page 7: WCF from the web developer

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

Page 8: WCF from the web developer

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)

Page 9: WCF from the web developer

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

Page 10: WCF from the web developer

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>

Page 11: WCF from the web developer

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)

Page 12: WCF from the web developer

A REST request

GET www.quickbank.com/Accounts/2

WCF Client

WCF Service

Account 1

Account 2

Account 3

Page 13: WCF from the web developer

Demo: Twitter REST Service

webHttpBindingHTTP

Transport (Web

Message Encoding)

Formats:XML, JSONRSS, ATOM

Page 14: WCF from the web developer

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

Page 15: WCF from the web developer

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…

Page 16: WCF from the web developer

OData: WCF Data ServicesOpen Data Protocol

REST-based protocol for CRUD-style operations

Based on AtomPubFormats: Atom, Xml, JSON

DEMO

Page 17: WCF from the web developer

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

Page 18: WCF from the web developer

ResourcesAaron Skonnard, www.pluralsight.comDavid Chappel, www.davidchappel.com

http://wildermuth.comMichele Bustamante, www.thatindigogirl.com

MSDN REST Starter Kit

Page 19: WCF from the web developer

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

Page 20: WCF from the web developer

Demo: REST in .NET 4.0CachingAutomatic format selectionREST Starter Kit:

Client API Paste as Xml