Hi,
Can webservices be accessed by Silverlight 3? On VisualStudio, a Silverlight project doesn't allow me to add a "web reference" but only a "web service reference" that is for WCF and not "normal" webservices.
Any help?
Thanks
Hi,
Can webservices be accessed by Silverlight 3? On VisualStudio, a Silverlight project doesn't allow me to add a "web reference" but only a "web service reference" that is for WCF and not "normal" webservices.
Any help?
Thanks
Sure you can. In your web project, add a new asmx webservice and add whatever functions you want. Then build your web project.
Next, go to your silverlight project, right click on Service References, select Add Service reference. If you then hit the Discover button in the dialog that pops up, it should discover your new web service. If it doesn't, then you can manually enter the url to it - if you have Cassini running (press F5 in your web project, then close the browser window once launched, Cassini will continue to run in the background) just enter http://localhost:[port]/MyWebService.asmx
as the address. The [port] is whatever port you have Cassini running on for this particular project).
Also don't forget to kee the cross domain limitations and work arounds in scope when considering any implementation:
Also there is a great MIX video on this:
Consuming Web Services in Microsoft Silverlight 3
Description: Come hear how to work with external REST, SOAP, and Windows Communication Foundation (WCF) services from Silverlight. Learn how to securely and efficiently communicate with services using Binary XML, debug services with improved Faults support, and implement server-to-client "push" using the new Add Service Reference for Duplex functionality.