2 No Silverlight (2) Application is an Island (of richness) Mike Taulty Microsoft UK...

Preview:

Citation preview

2

No Silverlight (2) Application is an Island (of richness)Mike TaultyMicrosoft UKMike.Taulty@microsoft.com http://www.mtaulty.com

3

The Silverlight Island

HTML

Silverlight

4

Island Hopping – The Page

Silverlight

5

Reaching out to the browser

Demo

6

Island Hopping – The Machine

Silverlight

7

Reaching out to the machine

Demo

8

Island Hopping – The Web

9

Island Hopping – The Web

Implicit HTTP Requests

Explicit HTTP Requests

Web Service Calls

Sockets Site of Origin

Cross-Site

Cross-Site

Asyn

chro

nous

API

’s

Transports

SerializationWCF DataContractXML JSON

XML Serializer

HTTP(S) ( request/response )

Protocols with Client Library Support“SOAP”

SOAP 1.1 via WCF

“REST”ADO.NET Data

Services

“Syndication”RSS 2.0 & ATOM 1.0 via

WCF

Sockets ( duplex )

Uses

10

Making Use of HTTPWe won’t focus on implicit access

2 main classes for explicit access

WebClient offers simple GET/POST– HttpWebRequest offers more control

Browser API’s limit HTTP verbs to GET/POST

11

Reaching out with HTTP

Demo

12

SOAPy Web Services with WCFOnly basicHttpBinding is “in the box”– SOAP 1.1, XML, HTTP(S)– not WS-Security, WS-Trust etc.

Derived PollingDuplexHttpBinding for duplex– Uses WS-Make Connection for polling over HTTP

Familiar Programming model– Client side object model– Configuration file - loaded from the XAP– “Add Service Reference” tooling in Visual Studio

Support for ASMX web services via XmlSerializer– Limited around some SOAP-controlling attributes

13

Reaching out with SOAP

Demo

14

RESTful Services & SyndicationADO.NET Data Services– RESTful services from .NET Framework V3.5 Sp1– Tunnels PUT/DELETE via POST to avoid the browser API HTTP

limitationAJAX Services, RSS, ATOM and Other Services– Use WebClient/HttpWebRequest – Serialize/De-serialize data with;

– XmlSerializer, DataContractSerializer, DataContractJsonSerializer– SyndicationFeed, Rss20FeedFormatter, Atom10FeedFormatter

15

Reaching out with REST, RSS

Demo

16

Making Cross-Domain Requests

www.server1.com

Requests Page with SilverlightApplication

www.server2.com

App Requests Cross-Site Resourcehttp://www.server2.com/vroot/foo.xml

clientaccesspolicy.xml

Framework attempts to accesshttp://www.server2.com/ looking for crossdomain.xml

Framework falls back to accesshttp://www.server2.com/ looking for

<access-policy> ... <grant-to /> ..</access-policy>

CheckPolicy

17

Reaching out cross-domain

Demo

18

Making Cross-Scheme Requests

Requests Page with SilverlightApplication over HTTP

App Requests Resource over HTTPS

www.server1.com

19

Communicating with Sockets

Client can connectClient cannot listen

Connectport 4502

Fixed port range4502 - 4534

Framework uses a well known port943 and sends an XML (UTF8) request fora client access policy

<policy-file-request/>

4502

943

<access-policy> ... <grant-to 4502/> ..</access-policy>

response

<access-policy> ... <grant-to 4502/> ..</access-policy>

CheckPolicy

async, duplex comms

20

Reaching out with sockets

Demo

21

No Silverlight Application is an Island

Silverlight

22

Resources

www.silverlight.net

23

Resources

www.microsoft.com/teched Tech·Talks Tech·Ed BloggersLive Simulcasts Virtual Labs

http://microsoft.com/expression http://msdn.microsoft.com

Developer’s Kit, Licenses, and MORE!

24

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

Recommended