views:

51

answers:

3

I have an ASP.net application that currently consumes SOAP web services. This platform is targeted at .net 2.0 and I use Visual Studio Professional 2005 to maintain it. I now have a requirement to consume a number of restful web service within the same application.

Is the consumption of Restful web services with WCF so trivial, compared to using HttpClient that it is worth the cost and time of upgrading to Visual Studio 2008 and .Net 3.5 framework

A: 

Here is a link describing what to do.

http://blogs.msdn.com/pedram/archive/2008/04/21/how-to-consume-rest-services-with-wcf.aspx

I would upgrade, as they have put things in place to make your work easier. Upgrading to 3.5 gives you other advantages over 2.0 as well, so you are not only getting REST components, but other things like LINQ, extension methods etc.

Remember, you don't need a new runtime environment to use .net 3.5, so if you absolutely can't install 3.5 on the server, you can include the 3.5 assemblies when you deploy it and it should work.

Kevin
A: 

Check out the WCF REST screencasts on Channel9:

http://channel9.msdn.com/tags/REST%20Starter%20Kit%20endpoint%20screencasts/

In particular this one here: Consuming REST services with HttpClient

Spend 15 minutes on that screencast and then judge for yourself! :-)

marc_s
Just to clarify, WCF REST HttpClient does not use WCF to communicate with the server, it uses the plain, vanilla HTTP stack in System.Net.
Darrel Miller
+3  A: 

I would never discourage anyone from upgrading to VS2008 and .Net 3.5, however, I would also never encourage anyone to use WCF on the client to communicate with an HTTP endpoint.

I would highly recommend that you look at the HTTP client library that is available in the WCF REST Starter Kit. This library however, despite its name, does not require WCF or .NET 3.5. To use the Microsoft.Http.HttpClient you only need .net 2.0. You only need 3.5 if you use the Microsoft.Http.Extensions DLL which has helper methods to use DataContract serializer and Syndication Feeds.

In my opinion, do not get sucked into doing client side DataContracts for remote services, it is really the tail wagging the dog and you will suffer in the long term. There are a few examples of questions here on Stack Overflow of people struggling with trying to get the DataContracts to produce the exact XML that a service requires.

Darrel Miller