Solution : Cross domain policy issue while calling SOAP service from your application

Some days back I was trying to call a .net SOAP web service from my Silverlight application. This was my first attempt to call a SOAP service from a Silverlight application and I saw this error

An error occurred while trying to make a request to URI ‘’. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details.

After some hours of searching I found a solution. It was just like I didn’t tell my server that how to manage the requests from other domain. This problem only occurs when you will try to call a SOAP web service from any client side application like Silverlight, flash etc.

So the solution here was just a little XML file that we need to place on our domain root folder. Like as on my domain I have to put this XML file named crossdomain.xml on root of the domain and content of the file should be like this:

<cross -domain-policy="-domain-policy">
                <allow -http-request-headers-from="-http-request-headers-from" domain="*" headers="*">

This will allow any application from any domain to call your web service. If you want to restrict your service for some specific domain you can change the domain name from “*” to some specific domain which you want to allow for this web service in crossdomain.xml.

Leave a Reply

Your email address will not be published.