Silverlight 4 – A Guided Tour of MEF

wispxylopolistInternet and Web Development

Aug 7, 2012 (5 years and 2 months ago)

422 views

Change the
Rules
– Silverlight 4 Networking
, Mike Taulty Microsoft UK
.mtaulty@microsoft com
.mtaultycom
@mtaulty
browser launched, rich
internet
apps
have
limited
local access
Host OS Resources
Host OS Resources
files
files
hardware
hardware
software
software
...
...
limited?

security

cross-platform
limited?

security

cross-platform
relaxed sandbox
relaxed sandbox
strong sandbox
strong sandbox
different
types
of Silverlight 4 apps
in browser
out of browser
trusted
network access is
constrained for
-non
trusted
apps
rich, controlled network access is
key
site of origin
other sites
intranet servers
firewall
being
network aware
is useful
& handle this event then call this method

”job done
all network access is asynchronous
Begin
Begin
your code
not your code
do not try to subvert this model
End
End
network stack sketch
WCF
WCF
WCF Data Services
WCF Data Services
TCP
TCP
UDP
UDP
socket libraries
socket libraries
HTTP
HTTP
HTTP Client Libraries
HTTP Client Libraries

”network

”network
application code
application code
lots of
capabilities
to
choose
from

network protocols

, , HTTP TCP UDP

data encodings

, text binary

data serialization

, , , XML JSON RSS ATOM

messaging protocols

, , SOAP REST OData

messaging patterns

 , , request response duplex multicast

programming models

, , , raw HTTP WCF WCF Data Services sockets

security

-, , -cross site authentication cross scheme
and two key classes for HTTP itself

WebClient

simple, easier to use

(Http)WebRequest

more functionality, slightly more
complex code
cross-domain security policy
../.wwwdomainonecommyappxap
..//.wwwdomaintwocomvdir resourcexml
policy
../.wwwdomaintwocomcrossdomainxml
../.wwwdomaintwocomclientaccesspolicyxml
?
policy
?
there are two http stacks
the
browser
stack
the
browser
stack
the
client
stack
the
client
stack
cookies are
not shared
switching between stacks
or per
domain
or per
request
can be done per
scheme
Change the
Rules
demo
reaching out with HTTP
lots of
capabilities
to
choose
from

network protocols

, , HTTP TCP UDP

data encodings

, text binary

data serialization

, , , XML JSON RSS ATOM

messaging protocols

, , SOAP REST OData

messaging patterns

 , , request response duplex multicast

programming models

, , , raw HTTP WCF WCF Data Services sockets

security

-, , -cross site authentication cross scheme
sockets

support for
streaming
TCP sockets

, Silverlight is a socket client
not
a server

consider WCF
netTCP
as a better option

security

limited to ports 4502 to 4534

- policy file authorisation required
HTTP
or
TCP
download

these restrictions do not apply to
trusted

applications
policy
policy
?
connect socket?
“< - -/>”port 943 policy file request
connected socket
connected socket
sockets

support for
multicast
UDP sockets

& both single source any source
multicasting

programmability is via

Udp
[/]Single Any
SourceMulticastClient
classes

security

port numbers must be above
1024

– policy file authorisation required
UDP

download

these restrictions do not apply to
trusted

applications
multicast security
single source multicasting
join?
unicast announces to
UDP port 9430
#random
- - site of origin URI
multicast group address
port number
receives authorisation
or times out
, for any source multicasting the Silverlight client multicasts to the multicast group on
port 9430 and waits for an authorisation
Change the Rules
demo
reaching out with sockets
lots of capabilities to choose from

network protocols

, , HTTP TCP UDP

data encodings

, text binary

data serialization

, , , XML JSON RSS ATOM

messaging protocols

, , SOAP REST OData

messaging patterns

 , , request response duplex multicast

programming models

, , , raw HTTP WCF WCF Data Services sockets

security

-, , -cross site authentication cross scheme
WCF
subset
in Silverlight for HTTP/TCP

transports
-
( ) HTTP S and TCP

encodings

-
text and binary

serialization
- * & *DataContract XmlSerializer

protocols
-
- . WS I Basic Profile 11

, , XML HTTP SOAP and WSDL

., - ., - *SOAP 12 WS Addressing 10 WS Security

patterns
-
/, *, *reqresp duplex polled duplex

privacy
-
HTTPS

authN
- transport or message credential

faults

- only available on the
client
stack
: - NB security policy enforcement still applies to non trusted applications
Change the
Rules
dem
o
reaching out with WCF via
/HTTPTCP
lots of capabilities to choose from

network protocols

, , HTTP TCP UDP

data encodings

, text binary

data serialization

, , , XML JSON RSS ATOM

messaging protocols

, , SOAP REST OData

messaging patterns

 , , request response duplex multicast

programming models

, , , raw HTTP WCF WCF Data Services sockets

security

-, , -cross site authentication cross scheme
RESTful services ( generically )
Resources
Resources
Res 1
Res 1
Res 2
Res 2
Res 3
Res 3
Res 4
Res 4
HTTP Request
HTTP Request
URL
URL
VERB
VERB
Payload
Payload
HTTP Response
HTTP Response
Status
Status
GET
GET
POST
POST
PUT
PUT
DELETE
DELETE
XML
JSON
Payload
Payload
XML
JSON
RESTful services ( more specifically )

( Open Data Protocol
odata
)

.. wwwodataorg

published under the Open Specification Promise

Extends the
AtomPub
standard to add

an
addressing
scheme

a mechanism for
schema

– alternate representation
JSON

handling for
concurrent
updates

handling for
batched
requests
WCF Data Services ( “Astoria” )

implementation of
odata
for the client
and the server
request metadata
metadata
WCF Data Services
Libraries
WCF Data Services
Libraries
generated proxy code
generated proxy code
WCF Data Services
Libraries
WCF Data Services
Libraries
DataModel

EntityFramework

LINQ to SQL

Custom
DataModel

EntityFramework

LINQ to SQL

Custom
LINQ Query
LINQ Query
Java
PHP
SharePoint
WebSphere
Java
PHP
SharePoint
WebSphere

” Other OData Implementations
. NET OData Implementation
:///(‘ ’)/=http server customers alfki Orders?$top 20
Atom
Change the Rules
dem
o
reaching out with WCF Data
Services
higher ground – WCF RIA Services
DomainService
+ Stateless CRUD App Logic
class PlateViewDomainService
< > ()IQueryable Restaurant GetRestaurants
< > IQueryable Restaurant
( )SearchRestaurant string
( )void AddRestaurant Restaurant
,Validation and authorization rules

, …Application workflows
Data Model

class Restaurant
DomainContext
+ Stateful view Bindable Data
class PlateViewDomainService
< > { }EntityList Restaurant Books get
< > ()EntityQuery Restaurant GetRestaurantQuery
< > ( )EntityQuery Restaurant SearchRestaurantQuery string
class
Restaurant
+ Data members Validation
Data Model
+
+Metadata
Shared
Code
Rich Internet Application
Rich Internet Application
DB
DB
Data Access Layer
Data Access Layer
App
Logic
App
Logic
Presentation
Logic
Presentation
Logic
DomainContext
DomainContext
Data
Service
Data
Service
Under the covers infrastructure
: Note Slide stolen from Brad Abrams
higher ground – WCF RIA Services

WCF RIA Services
( . )fka NET RIA Services

’ Yourebuildinganapplication

’ Youre responsible for both server and client deep in
business logic and semantics

WCF Data Services
( “ ”)fka Astoria

’ / Youreexposingacquiringdata

, You control one side or the other not both

/ CRUD among arbitrary producers consumers logic and
semantics are invisible
: NB Slide stolen from Brad Abrams
Change the
Rules

Silverlight
4 for Desktop
Developers”
sessio
n
, Ingo Rammer ThinkTecture
: 1450 today
resources

Channel 9 Silverlight 4 MEF Screencasts

..//channel9msdncomtags
SL4Networking

.Silverlight NET

.. wwwsilverlight net
thank you for coming – please provide feedback
feedback


Change the Rules
– Silverlight 4 Networking
, Mike Taulty Microsoft UK
.mtaulty@microsoft com
.mtaultycom
@mtaulty