Programming with .NET - Generalhttp://forums.silverlight.net//17.aspx/1?Programming+with+NET+GeneralGeneral discussions around authoring Silverlight .NET applications.Mon, 01 Jan 0001 00:00:00 -05001717794http://forums.silverlight.net//p/5807/17794.aspx/1?Example+of+using+WCF+with+Silverlight+1+1Example of using WCF with Silverlight 1.1 <p>Is there any official microsoft example of using WCF services with Silverlight 1.1 alpha?</p> <p>If anybody knows a good example with source code plz give me a link to this resource.<br> </p> 2007-10-18T07:47:16-04:0017853http://forums.silverlight.net//p/5807/17853.aspx/1?Re+Example+of+using+WCF+with+Silverlight+1+1Re: Example of using WCF with Silverlight 1.1 <p>I believe, for the time being, that the only method of communication that is supported by SL is JSON serialized web services.&nbsp; WCF should be supported in later releases and before SL 1.1 goes live.</p> 2007-10-18T15:21:57-04:0017859http://forums.silverlight.net//p/5807/17859.aspx/1?Re+Example+of+using+WCF+with+Silverlight+1+1Re: Example of using WCF with Silverlight 1.1 <p>The way I got it to work was by using a proxy to an asmx service in my web application, which is a proxy to the WCF service. This is because Silverlight and WCF don't like each other, so you can use a web application to mediate and make them play <em>nicer </em>(see #3 below).&nbsp;The structure is like this:</p> <p>The solution contains a Silverlight 1.1 application, an ASP.NET Futures application and a WCF service project. The ASP.NET Futures application contains an asmx service implementing the WCF service contract and passing through to that service.&nbsp;A proxy class for the asmx service is generated using slwsdl.exe and added to the Silverlight application (See #1 below. Use that proxy in your Silverlight app to call your service methods.) The hookup is completed by adding a Silverlight link to the web application and using the ASP.NET Futures XamlControl to host your Silverlight content. </p> <p>Some things to consider about this approach: </p> <ol> <li> <div>You'll need to manually set the Url property of the generated Silverlight proxy to the relative path of the asmx service in the web application. Since the Silverlight content will reside in the web application, the relative Url will resolve to the asmx service. This is how you get around the cross domain calls exception the <span>BrowserHttpWebRequest</span> likes to throw. </div> </li><li> <div>You can't debug the service calls in your Silverlight application -- you have to do it from the web application. The Silverlight application won't function independently because it needs the asmx service in the web application. And System.ServiceModel and Silverlight don't like each other, so you can't implement the asmx proxy in Silverlight. At least I couldn't figure out how.</div> </li><li> <div>Something about what is happening under the hood fails service methods with multiple arguments. I've seen stuff out there talking about this, but I can't recall the reason. Should be easy enough to find. This is the big ugly for me.</div> </li></ol> <p>I can provide a base implementation if you'd like. I'm not sure if this is the best way to do it, but it worked for me and doesn't require too much smoke and mirrors or compromise.</p> 2007-10-18T16:46:27-04:0032775http://forums.silverlight.net//p/5807/32775.aspx/1?Re+Re+Example+of+using+WCF+with+Silverlight+1+1Re: Re: Example of using WCF with Silverlight 1.1 <p>Hello, thanks for these ideas,</p> <p>I want to ask about how to configure the binding between the asmx service to the wcf and from the silverlight to the asmx if i want to enable callbacks,</p> <p>I also ask if you can provide a simple implementation of&nbsp;working source&nbsp;code</p> <p>Thanks alot,</p> 2008-02-26T18:35:20-05:0032776http://forums.silverlight.net//p/5807/32776.aspx/1?Re+Re+Example+of+using+WCF+with+Silverlight+1+1Re: Re: Example of using WCF with Silverlight 1.1 <p>Wait for 2.0 beta, it's not that much longer...</p> 2008-02-26T18:47:05-05:0032783http://forums.silverlight.net//p/5807/32783.aspx/1?Re+Re+Re+Example+of+using+WCF+with+Silverlight+1+1Re: Re: Re: Example of using WCF with Silverlight 1.1 <p>...Agreed [;)]</p> 2008-02-26T20:09:09-05:00