Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am implementing a RESTful web service and several client applications that are mostly in Silverlight. I am finding a litany of options for developing both the server-side and client-side of the API but am not sure which is the best approach. I'm concerned about stability as well as a platform that will continue to exist a few months from now.

We started using the REST Starter Kit with .NET 3.5 but moved to the new WCF Web API when updating to .NET 4.0. All of their documentation indicates that WCF Web API is the replacement for the RSK. However, Web API is only in Preview 4 and does not include support for Silverlight or Windows Phone 7 clients (yet).

WCF Web API looks like a wrapper on top of the WCF WebHttp Services stuff provided in the System.ServiceModel.Web library which makes me think that maybe it would be simpler to just go with the built-in stuff but Web API does offer some nice features.

I am specifically tied-up trying to determine the best course for the client-side. My main requirement is that I need to support deserializing into my client-side objects quickly and easily. The Web API offers a nice client library but doesn't have a Silverlight version.

I'd like to use the latest approach and the toolset that is being actively developed and supported.

  1. Is the REST Starter Kit really obsolete?

  2. Has anyone had any success implementing the WCF Web API toolkit?

  3. Is there merit to using either of these over the built-in WCF WebHttp Services features found in System.ServiceModel.Web?

  4. Is there a single solution that works for any client (web, Silverlight, etc.)?

What suggestions do you have?

share|improve this question
    
I would highly recommend using servicestack –  Mithir Mar 30 '13 at 5:15

3 Answers 3

The WCF Web API doesn't provide any metadata information you would use to generate a service proxy and thus, be able to add a service reference. It is intended for the easy production of REST services under the WCF umbrella, just as you do with the ASP.NET MVC 4 Web API framework.

Therefore there is no support for WP7 or Silverlight, but it is almost perfect for the rest of the web.

However, WCF Data Services looks like a right candidate, it allows you to create RESTful services and easily consume them with Silverlight.

share|improve this answer
    
We've been using the Web API with our Silverlight client for nearly a year with no issues. –  SonOfPirate Oct 29 '12 at 19:41
up vote 6 down vote accepted

Just to follow-up and close out the post, with Preview 5, the WCF Web API took a huge leap forward making it incredibly simple to create REST APIs. And while the current codebase on Codeplex does not include a Silverlight client, there is a toolkit out there and I was able to easily strip out the Async-CTP parts from the open source code and create a SL version.

I strongly recommend anyone interested in getting into REST with WCF look into the framework: http://wcf.codeplex.com.

FYI - It will be an integrated part of .NET 4.5 and is currently being rewritten to run on the same core framework as ASP.NET MVC (although I am told it will definitely support self-hosting still).

share|improve this answer

I havent used the REST Starter Kit but as im currently writing a .net 4.0 WCF REST API im fairly sure it does still exist :)

I would recomend you have a look at odata. Its amazingly quick and simple to code and plays nicely with silverlight.

share|improve this answer
    
One of the features offered by the WCF Web API toolkit is OData support which works nicely. But, not having a Silverlight version doesn't help me. How are you handling deserialization on the client side? –  SonOfPirate Sep 6 '11 at 13:16
    
I have only done it with WP7 silverlight. That i just added a service refrence and called that. You could just use a webclient and deserialize the response yourself though if that works better for you. Its not hard –  Tom Squires Sep 6 '11 at 13:35
    
I didn't think using webHttpBinding to enable REST with WCF supported a mex endpoint. How are you adding a service reference? That would be my preference over sharing a common library containing my data contracts. –  SonOfPirate Sep 6 '11 at 13:38
    
Yeh, i just added a service refrence. You might need to define the endpoint in the configuratation file. –  Tom Squires Sep 7 '11 at 16:00
    
I just learned (the hard way) that Silverlight doesn't support the WebHttpBinding. So, even though I was able to expose a mex endpoint and Add Service Reference, the service wouldn't make the call because it couldn't resolve the endpoint. –  SonOfPirate Sep 9 '11 at 18:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.