开发者

REST is not a standard 'Per-Se' so why does WCF create a wsdl, whats the point, and is it worse than SOAP? [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

What is the point in a WSDL with a rest based service?

I have to decide whether to implement a SOAP or REST based architecture for our API. Im drawn to REST because of its simple design pattern and relative ease at which it can be tested (through a browser for all GET requets for example).

However im being told that because SOAP is more standardized than REST its better for service oriented architecture and therefor better.

I can see the logic in this argument but I also see that..

  1. Http is standard
  2. The documents JSON and XML are very standard
  3. My REST webservice creates a wsdl.

Really its point 3 that seems to confuse me if REST is so 'un-standard' then why does it create a WSDL? A SOAP interface creates a WSDL. Both WSDL's can change (if the service changes) so ultimately whats the difference?

I really dont need to implement WS* features now or at any date most likely. It would also be beneficial to be able to call this API from our own ajax controls. And for people to be able to call it from ajax. Seems like to me that REST is the way forward but yes need to check really.

Hope someone can help开发者_StackOverflow.


Have you already read answers in your previous question? WCF will generate WSDL for your REST service but client generated from that WSDL doesn't work and it doesn't work because WSDL doesn't correctly describe your service. In .NET 4 if you try to open service exposing REST endpoints in WcfTestClient it omits these endpoints because it understands that it cannot call them. For describing REST service WCF 4 offers help page.

SOAP is standard but REST is architecture approach. Sometimes it is said that REST services are used when you want to have public consumers (especially mobile devices) and SOAP services are used for internal and B2B development but it is not true.

SOAP is basically operation oriented. You have a service which offers as many operations as you want. Basic SOAP uses only HTTP POST and well known content-type. In REST you have as many resources as you want but you have limited set of operations - HTTP verbs. Moreover you can expose resource in many content types. True REST service is self descriptive because resource links other resources and you can navigate through links in the similar way you navigate through hypertext.

When using SOAP service you have a protocol to talk. When using REST service the content itself is a "protocol" defined just for service needs.

The problem here is that current WCF plant REST functionality on infrastructure created for SOAP services. It is nice to have unified API but it blurs the difference between these two approaches.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜