Microsoft Silverlight 2.0 and the Last.FM webservices
Hi All,
After the release of Silverlight 2.0 last week i tried to make a nice Silverlight banner that reads the Last.FM webservices. A great new feature (WebClient Class) is introduced in Silverlight that enable you to read data from the internet. Too bad MS included a new security method on webservice calls: The WebClient class does not currently support cross-domain calls. The current release of WebClient requires that the Silverlight-based application be hosted on the same server as the target Web service. Alternatively, if the Web service and Silverlight-based application are hosted in separate domains, the Web service hosting the service must have an XML policy file that indicates that clients can make these cross-domain calls. from this page: Sending and Receiving Plain XML Messages with Silverlight a sample app on Scott Guthrie's sample.
According to MS the webservice provider has to explicitly opt-in to allow cross-domain access. By opting-in, a service states that the operations it exposes can safely be invoked by a Silverlight control, without potentially damaging consequences to the data the service stores.
The solution is to add a XML to http://ws.audioscrobbler.com: Silverlight supports two different mechanisms for services to opt-in to cross-domain access:
Place a clientaccesspolicy.xml file at the root of the domain where the service is hosted to configure the service to allow cross-domain-access.
Place a valid crossdomain.xml file at the root of the domain where the service is hosted. The file must mark the entire domain public. Silverlight supports a subset of the crossdomain.xml schema.
Microsoft Silverlight 2.0 and the Last.FM webservices