no silverlight application is an island of richness
DESCRIPTION
No Silverlight Application Is an Island of RichnessTRANSCRIPT
1
No Silverlight application is an island (of richness)
Mike TaultyDeveloper & Platform GroupMicrosoft [email protected] http://www.miketaulty.com
The Silverlight Island
HTMLHTML(is humdrum)(is humdrum)
SilverlightSilverlight(is sexy)(is sexy)
Island Hopping – The Page
4
Reaching out to the browser
Island Hopping – The Machine
6
Reaching out to the machine
Island Hopping – The Web
Island Hopping – The Web
Implicit HTTP RequestsImplicit HTTP Requests
Explicit HTTP RequestsExplicit HTTP Requests
Web Service CallsWeb Service Calls
SocketsSocketsSite of Origin
Cross-Site
Cross-Site
TransportsTransports
SerializationSerialization
XML SerializerXML Serializer
HTTP(S) ( request/response )HTTP(S) ( request/response )
Protocols with Client Library SupportProtocols with Client Library Support
““SOAP”SOAP”SOAP 1.1 via SOAP 1.1 via
WCFWCF
““REST”REST”ADO.NET Data ADO.NET Data
ServicesServices
““Syndication”Syndication”RSS 2.0 & ATOM 1.0 via RSS 2.0 & ATOM 1.0 via
WCFWCF
Sockets ( duplex )Sockets ( duplex )
Uses
Making Use of HTTP
We 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 ( GET, POST )
10
Reaching out via HTTP
SOAPy Web Services with WCF
Only basicHttpBinding is “in the box”SOAP 1.1, XML, HTTP(S)not WS-Security, WS-Trust etc.
Derived PollingDuplexHttpBinding for duplexUses WS-Make Connection for polling over HTTP
Programming modelFamiliar client side object modelFamiliar configuration file - loaded from the XAPFamiliar “Add Service Reference” tooling in Visual Studio
Support for ASMX web services via XmlSerializerLimited around some SOAP-controlling attributes
12
Reaching out – SOAP
RESTful Services & Syndication
ADO.NET Data ServicesRESTful services from .NET Framework V3.5 Sp1datasvcutil.exe tool to generate proxy classesTunnels PUT/DELETE via POST to avoid the browser API HTTP limitation
AJAX Services, RSS, ATOM and Other ServicesUse WebClient/HttpWebRequest Serialize/De-serialize data with;
XmlSerializer, DataContractSerializer, DataContractJsonSerializerSyndicationFeed, Rss20FeedFormatter, Atom10FeedFormatter
14
Reaching out – REST & RSS
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>
CheckCheckPolicyPolicy
16
Reaching out across domains
Making Cross-Scheme Requests
www.server1.com
Requests Page with SilverlightApplication over HTTP
App Requests Resource over HTTPS
Communicating with Sockets
Client can connectClient cannot listen
ConnectConnectport 4502
Fixed port range4502 - 4534
Framework uses a well known port943 and sends an XML (UTF8) request fora client access policy
<policy-file-request/>
45045022
943943
<access-policy> ... <grant-to 4502/> ..</access-policy>
responseresponse
<access-policy> ... <grant-to 4502/> ..</access-policy>
CheckCheckPolicyPolicy
async, duplex commsasync, duplex comms
19
Reaching out – Socket style
Resources
www.silverlight.net
© 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.