Best way to write a RESTful service “client” in .Net?

Question :

Best way to write a RESTful service “client” in .Net?,

Answer :

What techniques do people use to “consume” services in the REST stile on .Net ? Plain http client? Related to this: many rest services are now using JSON (its tighter and faster) – so what JSON lib is used?


My approach was

  1. Write some libraries and interfaces to serialize your objects into REST-compatible XML.
    You can’t neccessarily just use the built-in serializers, because your service may not accept the same kind of XML that .NET wants to give you.

    Example: When passing booleans to a Rails REST service, "true" gets unserialized as true, whereas "True" (which .NET gives you) unserializes to false.

  2. Write some libraries to do the HTTP, wrapping around the basic .NET WebRequest objects.
    You might get some mileage out of some third party libraries in this area as it tends to be more standard. I found some issues though, such as this  so I’m glad I stuck with the basics.

That’s the answer Best way to write a RESTful service “client” in .Net?, Hope this helps those looking for an answer. Then we suggest to do a search for the next question and find the answer only on our site.

Disclaimer :

The answers provided above are only to be used to guide the learning process. The questions above are open-ended questions, meaning that many answers are not fixed as above. I hope this article can be useful, Thank you

Read More  Add a bookmark that is only javascript, not a URL