Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Calling ASMX - How avoid cross domain error ?
5 replies. Latest Post by JuliasW on December 12, 2007.
(0)
JuliasW
Member
168 points
114 Posts
12-09-2007 6:55 AM |
After watching the Getting Started Video, I thought consuming ASMX web services from Silverlight would be straightforward. The Video makes it look as simple as linking the Web Service Project to the Silverlight project, and copying a few xaml files
I have attempted to follow the same process by bringing in an ASMX Project into my Silverlight solution, Linking the projects, so that the ClientBin, and Silverlight controls appear in the same virtual directory as the ASMx service files. But I still get a Cross domain call error when I call via http://localhost/XAMLServer/TestPage.html Even though http://localhost/XAMLServer/XAMLService.asmx clearly provides my Services.
Has anyone else succeeded in consuming ASMX Calls from Silverlight ? Are there any clear step by step instructions, on deployment on IIS 6 and IIS 7.
NB I have previously got POX based services to work through enabling script services and parsing xamls - But the getting Started Video implied this was not necessary
NB I Tried IIS 7, but cannot get ASP.NET installed ! How frustrating just to get this technology to connect up.
Anyone know if Silverlight 2.0 make the Web/WCF service consumption simpler ?
Cheers
[Frustrated] Jules
y_makram
Contributor
6172 points
1,233 Posts
12-09-2007 10:39 AM |
I am not sure what is going wrong with your application. The best tutorial I have seen on integrating Silverlight 1.1 with web services is Peter Kellner post located at http://peterkellner.net/2007/06/18/silverlightdebugwebservicedotnet/
And regarding 2.0, according to Scott Guthrie announcement, there will be alot of enhancements to communication including allowing cross-domain invocations. Quoted from his post "Rich Networking Support: Silverlight will deliver rich networking support. The next Silverlight preview release will add support for REST, POX, RSS, and WS* communication. It will also add support for cross domain network access (so that Silverlight clients can access resources and data from any trusted source on the web)."
12-09-2007 2:37 PM |
Many Thanks for the reference. I had come across Peter post before, but had not tried his approach. I followed his method of using .NET 2.0 based Webservice and slwsdl to generate the proxy against an asmx web service, but now I get "JSON_IllegalPrimitive" on the web servcie call - I note that Peter is perhaps using JSON based web Service. But I am trying to call an asmx based web service - I suspect that is the real problem, I suspect the web service needs to be configured to accept calls from Browser script ( I have got POX based web service to run previously, but this required XML parsing on client)
So it is still not working out for me, Silverlight still does not like calling the asmx based services ! - I am getting closer, and mess around a bit more to see if I can get some configuration to work for me. I really want to end up calling WCF services, and through a 80 port, not some random dubugger assigned port number
It good news to hear that Silverlight 2.0 aims to help on this. So far its a pretty frustrating experience !
Again Thanks for taking the time to post advice
Jules
Cass
3157 points
654 Posts
12-09-2007 10:16 PM |
Hi Jules,
I think this project might help you, Silverlight Fun & Games
12-10-2007 3:43 AM |
Thats interesting, but that example does not consume ASMX based Web Servicies.
12-12-2007 10:50 AM |
OK, I have sorted it after finding the following walkthrough useful
http://blogs.msdn.com/bobfamiliar/archive/2007/08/30/adopting-silverlight-an-architects-point-of-view.aspx
Provides a simple walkthrough of Silverlight caling into scriptable ASMX web services. (and I simply referred to the Web Service via IIS 6 Virtual Directory.)
Cheers for all the Help