Geeks With Blogs
mikedopp Geekswithblogs (edition)

Applications interact with the outside world. mmm?

Mashups and such. ok

Many types of outside data....

  • Images
  • RSS
  • 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?

Custom services.

Recommended uses of services in silverlight

Using silverlight front end connecting to webservice or database directly.

Using C#

void list<product>getproducts (string searchstring)

  1. Create service
  2. Define What does
  3. Add Service reference
  4. Use the service

Silverlight-Enabled WCF Service

  • ServiceContract
  • OperationContract
  • DataContract

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


  •   Services
  •   Soap
  •   Soap internet
  •   SQL Server Data services

WSDL connection... nice!


No cross domain applications! cannot call using the same authentication

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.

Download code: 


  • 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

  • XMLReader/XMLWriter
  • Ling to XML
  • Serialize/DeSerialize
  • Build Type

JSON Data Format usage

JavaScriptObjectNotation easy fast to parse.

  • Binary XML
  • Linq to JSON
  • load JSON strings

RSS/Atom feeds


  • RSS 2.0
  • Atom1.0
  • Atom Publishing(future)


Looks promising but not fully cooked.


Posted on Wednesday, March 5, 2008 8:09 PM | Back to top

Comments on this post: Mix08- Working with Data and Web Services in Silverlight2.

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © mikedopp | Powered by: