How to access web services from silverlight app

I dont usually post technical stuff on this blog, as i dont get to code on my daily office routine, but I have been trying to experiment with Silverlight for a while.

Recently, I have spent many hours just to be able to access a simple hello-world asp.net webservices from a silverlight 2.0 application. Process is pretty simple as explained in Tim’s blog post. Create a webservice, include its reference in silverlight project, add an object of soapclient, add handle to the functions ( since calls are async) and then call the actual function.

Everything worked fine, but my app was unable to contact to my webservices, even though i was able to ‘discover’ them if I make webservice as part of my complete solution OR could access service functions, if hosted webservices on my localhost (IIS7). I am certainly running into cross domain policy issues. Nothing helped, not even having crossdomain.xml or clientaccesspolicy.xml.

I could solve this issue by removing these files ( clientaccesspolicy, crossdomain) from C:\inetpub\wwwroot\MyWebService to C:\inetpub\wwwroot\ and everything started working so perfect.

OK, i just found that Tim has another great post on cross domain policy where he has mentioned that I should copy policy files on the root of the website. Crap! I should read his blog post more often.

This entry was posted in Uncategorized and tagged , . Bookmark the permalink.
blog comments powered by Disqus