Saturday, March 24, 2012

Question about AJAX and WCF duplex services

OK, I have some existing WCF services that are working with a thick client download, but now we are trying to add a web front end option. I was able to get the one way services working easily by adding a web service page as a simple wrapper around the WCF calls. Now I need to look at our services that are duplex though. Is there a way to do this with the AJAX libraries that are out now? If not, is there a timeframe for when Microsoft might release the next preview that has WCF functionality added back in? And how stable was the older release that still had WCF functionality? Would it work with the release version of WCF?No unfortunately, ASP.NET AJAX has no support for WCF yet. It will be available in future versions. You can use POX to call WCF services but that will be one way and in that case you also should not have a service contract in your WCF service.
Well, if anyone else is caught in a situation like this in the interim, I found a pretty good workaround, at least for my situation. I actually wrote a second WCF service that acts as an aggregator of the first one. The new service only exposes plain http web services, so I can call it no problem from the AJAX code. The aggregator gets the duplex messages from the main server, so it updates in its memory in real time, and then the web page just polls it every few seconds for updates. It's not perfect, but it does what I need for now.

No comments:

Post a Comment