Page view counter
Calling ASMX - How avoid cross domain error ?
Last post 12-12-2007 10:50 AM by JuliasW. 5 replies.
Sort Posts:
12-09-2007 6:55 AM
Calling ASMX - How avoid cross domain error ?

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

JuliasW

Loading...
Joined on 09-25-2005
Posts 93
12-09-2007 10:39 AM
Re: Calling ASMX - How avoid cross domain error ?

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)."

Thanks
Yasser Makram
My Blog: http://www.silverlightrecipes.com
Sr. Architect
Santeon Inc. Microsoft Silverlight Partner, Solution Provider

y_makram

Loading...
Joined on 06-07-2007
Cairo, Egypt
Posts 1,143
12-09-2007 2:37 PM
Re: Calling ASMX - How avoid cross domain error ?

 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

Cheers

Jules

JuliasW

Loading...
Joined on 09-25-2005
Posts 93
12-09-2007 10:16 PM
Re: Calling ASMX - How avoid cross domain error ?

Hi Jules,

I think this project might help you, Silverlight Fun & Games 

--
Imran Shaik
If this answers your question please select "Mark as Answered"
Old Blog | Silverlight 2.0 Quintessential Rambling |My Feed

Cass

Loading...
Joined on 09-15-2007
London, UK
Posts 654
12-10-2007 3:43 AM
Re: consuming ASMx Web Services example?

Thats interesting, but that example does not consume ASMX based Web Servicies.

JuliasW

Loading...
Joined on 09-25-2005
Posts 93
12-12-2007 10:50 AM
Marked as Answer
Re: consuming ASMx Web Services example?

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

Jules

JuliasW

Loading...
Joined on 09-25-2005
Posts 93
Microsoft Communities