240 likes | 308 Views
No Silverlight (2) Application is an Island (of richness). Mike Taulty. Microsoft UK Mike.Taulty@microsoft.com http://www.mtaulty.com. The Silverlight Island. HTML. Silverlight. Island Hopping – The Page. Silverlight. Reaching out to the browser. Demo. Island Hopping – The Machine.
E N D
No Silverlight(2) Application is an Island (of richness) Mike Taulty Microsoft UK Mike.Taulty@microsoft.com http://www.mtaulty.com
The Silverlight Island HTML Silverlight
Island Hopping – The Page Silverlight
Island Hopping – The Machine Silverlight
Island Hopping – The Web Asynchronous API’s Implicit HTTP Requests Protocols with Client Library Support Explicit HTTP Requests “SOAP” SOAP 1.1 via WCF “REST” ADO.NET Data Services “Syndication” RSS 2.0 & ATOM 1.0 via WCF Serialization Uses Web Service Calls WCF DataContract XML Serializer XML JSON Sockets Transports Cross-Site Cross-Site Site of Origin HTTP(S) ( request/response ) Sockets ( duplex )
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 to GET/POST
SOAPy Web Services with WCF • Only basicHttpBindingis “in the box” • SOAP 1.1, XML, HTTP(S) • notWS-Security, WS-Trust etc. • Derived PollingDuplexHttpBindingfor 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
RESTful Services & Syndication • ADO.NET Data Services • RESTful services from .NET Framework V3.5 Sp1 • Tunnels PUT/DELETE via POST to avoid the browser API HTTP limitation • AJAX Services, RSS, ATOM and Other Services • Use WebClient/HttpWebRequest • Serialize/De-serialize data with; • XmlSerializer, DataContractSerializer, DataContractJsonSerializer • SyndicationFeed, Rss20FeedFormatter, Atom10FeedFormatter
Making Cross-Domain Requests www.server2.com Requests Page with Silverlight Application Check Policy <access-policy> ... <grant-to /> .. </access-policy> www.server1.com Framework attempts to access http://www.server2.com/ looking for Framework falls back to access http://www.server2.com/ looking for App Requests Cross-Site Resource http://www.server2.com/vroot/foo.xml clientaccesspolicy.xml crossdomain.xml
Making Cross-Scheme Requests Requests Page with Silverlight Application over HTTP www.server1.com App Requests Resource over HTTPS
Communicating with Sockets • Fixed port range • 4502 - 4534 4502 port 4502 Connect async, duplex comms Check Policy • Client can connect • Client cannot listen <access-policy> ... <grant-to 4502/> .. </access-policy> 943 <policy-file-request/> Framework uses a well known port 943 and sends an XML (UTF8) request for a client access policy <access-policy> ... <grant-to 4502/> .. </access-policy> response
No Silverlight Application is an Island Silverlight
Resources www.silverlight.net
Resources • www.microsoft.com/teched Tech·TalksTech·Ed Bloggers Live Simulcasts Virtual Labs • http://msdn.microsoft.com Developer’s Kit, Licenses, and MORE! • http://microsoft.com/expression
© 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.