15

I was just wondering are asmx files compatible with REST style requests?

I have some asmx files which need to service some third-party programs which are setup to send REST requests, not SOAP.

chobo
  • 31,561
  • 38
  • 123
  • 191

1 Answers1

18

First of all, you should not be using ASMX for new service development: you should use WCF instead. It's much easier with WCF to have the same service handle both SOAP and REST-style endpoints.

The closest that an ASMX service will get to REST is that it can be configured to permit a GET or POST request, in which case it will return plain XML, with no SOAP envelope.

See Configuration Options.

But if you're trying to get "true REST" from ASMX, then you're out of luck.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
  • It's an existing webservice not a new one. I'm trying to find out if I can make use of that one, or if I need to create a new one (wcf) – chobo Apr 19 '11 at 16:08
  • Check the "Configuration Options" link. You may be able to get away with using HttpGet or HttpPost. – John Saunders Apr 19 '11 at 16:11
  • I don't see how Get or Post would work very well. I would need one generic method controller that passes a request to other ones, or something like that. Because I need to reference the actual method names in the request and the is not how REST works. – chobo Apr 19 '11 at 16:24
  • I don't see why you would need a single controller or anything. You can use a GET or POST directly to the correct method. REST doesn't imply a particular URL structure, you know. – John Saunders Apr 19 '11 at 16:34
  • 1
    But if you're trying to get "true REST" from ASMX, then you're out of luck. In fact, how are you going to turn what is currently an RPC style service into one that is based on the concept of resources? – John Saunders Apr 19 '11 at 16:35
  • I was after true REST from the get go :) I'm glad to finally have a definitive answer. You can mod your original answer to include your comment above and i'll mark it. – chobo Apr 19 '11 at 16:38