简体   繁体   中英

Converting asmx SOAP webservice to REST on ASP.NET: is WCF really useful for just that ?

Why not just add http get support in config and that's done with the advantage that the service will be dual both SOAP AND REST?

What's all the buzz around rest ? What WCF will bring to this ?

I mean what's the difference from the viewpoint of a REST client application if I just set in my web.config for my asmx webservice to being able to accept get rest-like syntax

  <webServices>
    <protocols>
      <add name="HttpGet" />
    </protocols>
  </webServices>

and a WCF REST implementation http://geekswithblogs.net/.NETonMyMind/archive/2008/02/04/119291.aspx ?

seems nobody can really answer ... is it because it's hard or is it my question is stupid :)

Client only sees url (encapsulation principle) so why would I bother for more ? And what's the more that's still not clear :)

Other problem: if we switch to WCF, will we need to change url ? If yes that means all our hundred partners clients would be broken and I'll have to notify them of our change ?

WCF is nothing to do with the REST. You can build your own REST services without using WCF & SOAP stuff.. Check out this sample REST service build in .Net 2.0

and Check out the excellent .Net open source REST implementation

To understand more about REST, read these

  1. http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
  2. http://en.wikipedia.org/wiki/Representational_State_Transfer
  3. What exactly is RESTful programming?
  4. REST / SOAP endpoints for a WCF service
  5. Understanding REST: Verbs, error codes, and authentication

To your comment:

if I have already an asmx webservice that can be converted to REST just in one line of configuration file ?

ASMX services are build upon SOAP, one more layer over HTTP. REST is simply a HTTP based, You can access(or call) your business resources the way you access the normal URLs. No more abstractions.

In REST, resources are identified by persistent identifiers(URLs).

For ex in products catalog system, by using asmx you create set of functions to add,update,delete products. like addProduct(),updateProduct, etc..

But in REST, you will be having single point of access, like http:\\mysystem\\prodcuts. To retrieve,add,update,delete products, you will be using respective HTTP verbs (GET,POST,PUT,DELETE) on the same URL.

So you cannot just convert asmx to REST, since both solves the problems in different way.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM