Wednesday, March 05, 2008 1:09 PM
Mix08- Working with Data and Web Services in Silverlight2.
Applications interact with the outside world. mmm?
Mashups and such. ok
Many types of outside data....
- Business services
- Intranet services
- Mashup API's
silverlight1.1 xaml and fun
-no easy way to connect to other services.
What does client code look like?
Recommended uses of services in silverlight
Using silverlight front end connecting to webservice or database directly.
void list<product>getproducts (string searchstring)
- Create service
- Define What does
- Add Service reference
- Use the service
Silverlight-Enabled WCF Service
Reference the service
var proxy = new ShoppingServiceClient() [service]
- Default address chosen if no parameters given
- canpass in addresss manually
- but what if the service moves?
- Config support after beta1
Only uses async methods
migrate from silverlight1.1 on client side
- Remove web references
- do add service reference
- Data format is now SOAP, not JSON
Server-side no need to change!
Using cookie or session data to pass authentication.
silverlight consumes web page authentication.
HttpContext.Current.User = current user
Pull in outside service
Add Service Reference
- Soap internet
- SQL Server Data services
WSDL connection... nice!
No cross domain applications!
mysite.com cannot call yoursite.com using the same authentication mysite.com.
you can hack it using the policy files:
- silverlight policy file clientaccesspolicy.xml
- adobe policy file crossdomain.xml
3rd party authentication using browser based authentication is looked down upon.
Allowed Urls Http and https subject to cross domain rules no ftp or file://URLs
Sockets support for non-HTTP Services:
-originating server only.
- No Put,Delete
- Only get success of failure. No debugging? That's not so cool.
- -403 and 404 will not be displayed.
- Redirects:Work(may be blocked in cross-domain)
- Cannot override the browser
- Caching turned off
- http authentication
- read/write cookies.
Access to XML
- Ling to XML
- Build Type
JSON Data Format usage
- Binary XML
- Linq to JSON
- load JSON strings
- RSS 2.0
- Atom Publishing(future)
Looks promising but not fully cooked.
Filed under: MIX08, ASP.NET 2.0, Silverlight