开发者

When to Use WCF / REST

I am new to REST. I was reading many article about REST. Still I am confused a开发者_开发百科nd do not know exact reason when we should go for REST rather than WCF traditional services.


I don't think the two are mutually exclusive, see this question which has pointers to many other interesting posts on WCF and REST. In terms of whether or not you need to expose a RESTful service at all, that depends on your application.

If you are building a public API, using REST with JSON or XML is popular in part because it's a very generic way to expose an API since clients don't generally need to generate code to use your API. Whereas with something like SOAP, code generation for the client is a lot more standard. If your clients are javascript, for instance, it's quite easy to use a RESTful service. If your API is only for internal consumption (i.e. you own the client and the server), then the benefits of REST are somewhat diminished, and it may be easier to use something like WCF.

In general, REST is a good choice when you don't mind being limited to HTTP, your service endpoints can be described well using RESTful concepts, you don't need a contract (like a WSDL), and when you don't want to worry that a client of your service won't be supported for technical reasons.

I've used RESTful web services as a reference in the past, it's a great book.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜