+ All Categories
Home > Documents > Networking and Web Services in Silverlight

Networking and Web Services in Silverlight

Date post: 24-Feb-2016
Category:
Upload: dillian
View: 25 times
Download: 0 times
Share this document with a friend
Description:
CL06. Networking and Web Services in Silverlight. Yavor Georgiev Program Manager Microsoft Corporation. Getting Data Into Silverlight. Message Pattern. Interaction Model. Resource centric. Multicast. Duplex. Operation centric. Request/reply. - PowerPoint PPT Presentation
Popular Tags:
34
Networking and Web Services in Silverlight Yavor Georgiev Program Manager Microsoft Corporation CL06
Transcript
Page 1: Networking and Web Services in Silverlight

Networking and Web Services in Silverlight

Yavor GeorgievProgram ManagerMicrosoft Corporation

CL06

Page 2: Networking and Web Services in Silverlight

Getting Data Into Silverlight Interaction Model

Messag

e

Patte

rn Multicast

Duplex

Request/reply

Resourcecentric

Operationcentric

Page 3: Networking and Web Services in Silverlight

Data Access Examples> “Forms over data” E2E business app

> Access data from third-party REST service

> Access your database or SharePoint data model using REST

> App which accesses server business logic

> Chat app

> Streamed data (video, stock prices) inside an intranet

Page 4: Networking and Web Services in Silverlight

Interaction ModelMess

age

Pa

ttern

Resource-Centric Apps

Multicast

Duplex

Request/reply

Resourcecentric

Operationcentric

> “Forms over data” E2E business app

Page 5: Networking and Web Services in Silverlight

WCF RIA ServicesSystem.Web.DomainServices> “Forms over data” E2E business app

> Prescriptive model for CRUD services> Great tooling to maximize productivity> E2E data: sorting, paging, filtering,

validation…> RIA Services now built on top of WCF

> Productivity of RIA Services> Power and flexibility of WCF

> To learn more tomorrow:> CL21 @ 11:30AM - Building Amazing

Business Applications with Silverlight and .NET RIA Services

> CL07 @ 1:45PM - Mastering .NET RIA Services

Page 6: Networking and Web Services in Silverlight

WCF RIA Services

Interaction ModelMess

age

Pa

ttern

Resource-Centric Apps

Multicast

Duplex

Request/reply

Resourcecentric

Operationcentric

Page 7: Networking and Web Services in Silverlight

Travel Agent App

demo

Page 8: Networking and Web Services in Silverlight

Interaction ModelMess

age

Pa

ttern

Resource-Centric Apps

Multicast

Duplex

Request/reply

Resourcecentric

Operationcentric

> Access data from third-party REST service> Access your database or SharePoint data model

using REST

Page 9: Networking and Web Services in Silverlight

Accessing Public REST ServicesSystem.Net> ClientHttp networking stack

> Integrated with the OS networking stack> Supports common BrowserHttp stack

features for consistent experience> Better RESTful protocol support for

same and cross-domain scenarios> All HTTP verbs supported> Response bodies available for all HTTP

status codes> Authentication & cookies support

Page 10: Networking and Web Services in Silverlight

ClientHttp Stack FeaturesBrowserHttp Stack

ClientHttp Stack

Basic Authentication

Handled by browser No [SL3] Yes

Caching Handled by browser Not supportedConcurrent Connections

Handled by browser 6

Cookies Handled by browser Handled by appCross-domain Support

Need policy file Need file policy file [SL3] Not needed if elevated

Digest Authentication

Handled by browser No [SL3] Yes

HTTP Verbs GET, POST All (need policy file)NTLM Auth Handled by browser No [SL3] YesRequest Headers Only supported on

POSTSupported on all verbs

Response Body Only on 200 response Fully supportedResponse Headers Not supported Fully supportedStatus Codes Only 200/404 Fully supported

Page 11: Networking and Web Services in Silverlight

Travel Agent App

demo Accessing Public REST Services

Page 12: Networking and Web Services in Silverlight

Access a Data Model Using RESTSystem.Data.Services> WCF Data Services

> Formerly ADO.NET Data Services> Services with a RESTful interface and a

set of conventions designed for easy data sharing

> What is Data Services?> Server framework for .NET, others coming > Clients for Silverlight, .NET, PHP, Java,

AJAX> SharePoint 2010 uses a Data Service to

expose data

Page 13: Networking and Web Services in Silverlight

Data Services Client> Accessing Data Services

> Silverlight ClientHttp stack still an option> Data Services client more usable as it

knows the details of the data service interface

> Features> Full abstraction on top of the service – no

need to deal with HTTP, serialization, etc> Data as objects with automatic change

tracking> LINQ for queries> Data-binding friendly interfaces> Work same-domain and cross-domain

Page 14: Networking and Web Services in Silverlight

Travel Agent App

demo Accessing SharePoint Using aData Service

Page 15: Networking and Web Services in Silverlight

Aside: Windows Communication Foundation

Channel ModelFormats

(Atom, JSON, XML,…)

Transports(HTTP, TCP, …)

Protocols(SOAP, HTTP,

OData)

Service ModelData Contract Service

ContractService Behavior

Programming ModelCore

ServicesWeb HTTP

ServicesData

ServicesRIA

ServicesWorkflo

w Services

Page 16: Networking and Web Services in Silverlight

Interaction ModelMess

age

Pa

ttern

Resource-Centric Apps

Multicast

Duplex

Request/reply

Resourcecentric

Operationcentric

System.NetWCF Data

Services

> Access data from third-party REST service> Access your database or SharePoint data model

using REST

Page 17: Networking and Web Services in Silverlight

Interaction ModelMess

age

Pa

ttern

Operation-Centric Apps

Multicast

Duplex

Request/reply

Resourcecentric

Operationcentric

> App which accesses server business logic> Chat app> Streamed data (video, stock prices) inside an

intranet

Page 18: Networking and Web Services in Silverlight

Operation-Centric Apps with WCFSystem.ServiceModel> Accessing server business logic

> Generated proxies (Add Service Reference)

> Serialization of objects on the wire, faults> High-performance encoders> Different security approaches

> Chat scenario> High-level messaging patterns built on

top of networking APIs

Page 19: Networking and Web Services in Silverlight

Binary Message EncoderServer throughput increase

20 objects 100 objects

6122

2702

7570

4615

HP BL680c: 8 Intel EMT64 [email protected] Server 2008 64-bit, IIS7

Text / HTTP

Message complexity

Web

ser

vice

req

uest

s/se

c 24%

71%

Page 20: Networking and Web Services in Silverlight

Binary Message EncoderMessage size reduction

15%

34%

40%

String IntLarge object graph

Size

red

uctio

n

Page 21: Networking and Web Services in Silverlight

WCF Features> Faults enabled

> System.ServiceModel.CommunicationException was unhandled by user codeMessage="The remote server returned an error: NotFound."

> To get full exceptions, use ClientHttp stack

> Security in cross-domain scenarios enabled> Normally use browser-managed security

(generally not safe for cross-domain use)> Transport security with message

credentials in cross-domain scenarios

Page 22: Networking and Web Services in Silverlight

Duplex Messaging (Server Push)> Server push is compelling when server

has to notify client of events (email server)> Internet: PollingDuplex (HTTP-based)

> [Post SL4 Beta] response chunking for better performance

> [Post SL4 Beta] can scale across machines (web farms, Windows Azure) – Invensys case study

> Intranet: NetTcp (TCP sockets-based)> Also works for request/reply services

> Both offer the same programming model – just a matter of changing the binding

Page 23: Networking and Web Services in Silverlight

Duplex Messaging ScalabilityIntel Xeon 2 [email protected], 2GB RAMWindows Server 2008 32-bit, IIS7

1s 2s 5s 10s 30s0

1000

2000

3000

4000

5000

6000

7000

PollingDuplex

Message broadcast frequency

Max

imum

clie

nts

conn

ecte

d

Page 24: Networking and Web Services in Silverlight

Travel Agent App

demo Implementing Chat Using Duplex Messaging

Page 25: Networking and Web Services in Silverlight

Multicast MessagingSystem.Net> UDP multicast is a technique for one-

to-many communication over an IP infrastructure

> Scenarios> Market data streaming> Video and media streaming> Real-time communication> Device and service discovery

Page 26: Networking and Web Services in Silverlight

UDP Multicast Details> Scales to a large receiver population> Two key shapes for multicast groups:

> Single Source Multicast (one-to-many)System.Net.Sockets.UdpSingleSourceMulticastClient

> Any Source Multicast (many-to-many)System.Net.Sockets.UdpAnySourceMulticastClient

> Need to expose a policy responder (just like sockets and HTTP)> [Post SL4 Beta] Going away for both

sockets and multicast if app is elevated

Page 27: Networking and Web Services in Silverlight

WCFSystem.Net

System.Net

Interaction ModelMess

age

Pa

ttern

Operation-Centric Apps

Multicast

Duplex

Request/reply

Resourcecentric

Operationcentric

> App which accesses server business logic> Chat app> Streamed data (video, stock prices) inside an

intranet

Page 28: Networking and Web Services in Silverlight

Data Access Examples> “Forms over data” E2E business app

> WCF RIA Services (System.Web.DomainServices )> Access data from third-party REST service

> System.Net> Access your database or SharePoint data model using

REST> WCF Data Services (System.Data.Services)

> App which accesses server business logic> WCF (System.ServiceModel)

> Chat app> WCF (System.ServiceModel)

> Streamed data (video, stock prices) inside an intranet> System.Net

Page 29: Networking and Web Services in Silverlight

Additional Resources> Blogs:

> http://blogs.msdn.com/astoriateam> http://blogs.msdn.com/matos > http://blogs.msdn.com/ncl> http://blogs.msdn.com/silverlightws

(will have sample code from today)

> E-mail: [email protected]

Page 30: Networking and Web Services in Silverlight

Related Sessions> Today

> FT12 - ADO.NET Data Services: What’s New with the RESTful Data Services Framework

> FT55 - Developing REST Applications with the .NET Framework

> SVC31 - Lessons Learned: Building On-Premises and Cloud Applications with the Service Bus and Windows Azure

> Tomorrow> CL21 @ 11:30AM - Building Amazing Business

Applications with Silverlight and.NET RIA Services> CL07 @ 1:45PM - Mastering .NET RIA Services> PR12 @ 1:45PM - It's All about the Services:

Developing Custom Applications for SharePoint Server 2010 Using ASP.NET, WCF, and REST

Page 31: Networking and Web Services in Silverlight

YOUR FEEDBACK IS IMPORTANT TO US! Please fill out session evaluation

forms online atMicrosoftPDC.com

Page 32: Networking and Web Services in Silverlight

Learn More On Channel 9> Expand your PDC experience through

Channel 9

> Explore videos, hands-on labs, sample code and demos through the new Channel 9 training courses

channel9.msdn.com/learnBuilt by Developers for Developers….

Page 33: Networking and Web Services in Silverlight

© 2009 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.

Page 34: Networking and Web Services in Silverlight

Recommended