Cross Domain : Trouble while accessing Web Services
When Silverlight attempts to access a Web Service, if the SOO is different from the Web Service host, you have to deal with a cross domain issue. This issue can occur in various scenarios as described in Silverlight scenarios for Rich Internet Applications
The issue can be treated as follow :
1. I am encountering a ProtocolException
- Reason
Silverlight is attempting to access a Web Service which is across its own domain boundaries. For security reasons, a policy file must exist at the root of the Web Service host. It allows this cross-domain access : it’s either clientaccesspolicy.xml or crossdomain.xml files which were not found by Silverlight.
2. Even if the clientaccesspolicy.xml is found, my Silverlight application access the service
- Reason
Indeed, the clientaccesspolicy.xml file is here but is not accepted by the Silverlight application : there is some missing information.
There has been some modifications since Silverlight 2 beta 2 : Ensure that ‘http-request-headers’ attribute is correctly set in ‘allow-from’ element in the clientaccesspolicy.xml file. See below for a basic and working policy file :
<?xml version="1.0" encoding="UTF-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource include-subpaths="true" path="/"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
More information can be found at
http://msdn.microsoft.com/en-us/library/cc197955(VS.95).aspx
- Ronny Kwon
I work for Microsoft France as a Technology Evangelist with expertise in Enterprise Architecture, Interoperability, SOA & Cloud Computing.
Contact me or read one of my other blogs :
Think Big mais pas trop...,
SOA & Interop @Microsoft France,
Cloud Computing @ Microsoft France,
Silverlight, RIA & Interoperability
Au sein de l'équipe Entreprise de Microsoft France, je me concentre sur les problématiques Cloud Computing, SOA et Interopérabilité.
Contactez-moi ou bien consultez l'un de mes blogs :
Think Big mais pas trop...,
SOA & Interop @Microsoft France,
Cloud Computing @ Microsoft France,
Silverlight, RIA & Interoperability