Wednesday, December 07, 2011 5:14 PM
I have read several posts regarding this topic. It would have been helpfull if the authors mentioned that the majority of the examples are actually for Silverlight enabled WFC services, In my case, I need the SL4 app to connect to a plain WCF service, hosted in IIS in another server.
Using VS 2010 I created a simple WCF service, for test only, that returns the time as a string. Calling it from a browser I get the WSDL page so I assume it is working as expected. Actually it is cause I also tested it using a simple wcf client.
Now, here is the situation: (Let me just mention that I have created several SL4 apps before, that call silverlight enabled services with no problem)
I tried to access the service from a simple SL4 app that I created. I added a reference to the service but it crashes when I call it asynchronously, using the proxy class
NOTE: I changed the binding to basicHttpBinding BEFORE adding the reference and the crossdomain and the clientaccesspolicy files are in the same folder where the service is.
Then I created another SL4 and this time I didn't create the web part of the project and after I created the proxy class I couldn't find the xxxxCompleted and the xxxAsync methods to construct the assync call. The only option available was to call the service directly, which I did and it worked.
private void button1_Click(object sender, RoutedEventArgs e)
ServiceReference1.GetTimeClient proxy = new ServiceReference1.GetTimeClient();
label1.Content = proxy.WhatTimeisIt();
So, is it possible to access the WFC service in assync from a SL4? What I really need to do is to expose some data (That my clients have been accessing using a full SL4 app) as a service to other clients, that just want the xml file without using Silverlight. So, as I see it, the only option for the latter is to create the separated wfc service. But, to avoid having 2 services doing the same thing, I would remove the silverlight enabled one and have the app accesiing the other one.
Thanks for any replies