background preloader

Rest Service

Facebook Twitter

CREATE RESTful WCF Service API Using POST: Step By Step Guide. Download source - 25.43 KB Introduction In my previous article, I tried to explain about WCF Restful service using HTTP Get method.

CREATE RESTful WCF Service API Using POST: Step By Step Guide

This works well as long as you are sending small data as information to the service. But if want to deliver huge data, HTTP GET Method is not a good choice. In this article, we will create one WCF RESTFul POST API. Why to use POST, not GET? When I write any WCF service, I always use POST. Easy Character Encoding using application/x-www-form-urlencoded No Proxy by default so always actual data from web server Data length can be restricted by webserver, not by browser and lot more...

Extremely long URLs are usually a mistake. So if you are writing any REST service and your information is long enough, better to choose POST instead of GET method. In this article, I am going to create WCF Restful service using POST method and access it using HTTP Request. Step by Step Guide Launch Visual Studio 2010.

WCF "Raw" programming model (Web) - Carlos' blog. I've seen quite a few times in the forums people asking how to control exactly how the data returned by a WCF service.

WCF "Raw" programming model (Web) - Carlos' blog

People want to use a certain format for the output of the data which isn't (natively) supported by WCF, such as XML or JSON. A few examples of questions of this nature: I want to return the string "Hello world", but even though I set the BodyStyle property in the Web[Get/Invoke] attribute to Bare, the result is still wrapped in a <string> tag, like "<string xmlns="... ">Hello world</string>; how do I remove the <string> wrapper? I need to return my parameters in a certain format which is not supported by WCF. One way to do it is to create a separate MessageEncoder, which is capable of taking a Message object and converting it to the bytes, and use that encoder in the binding of the endpoint which contains the operation. WCF "Raw" programming model (Web) - receiving arbitrary data - Carlos' blog.

The previous post mentioned how to return arbitrary data from WCF services.

WCF "Raw" programming model (Web) - receiving arbitrary data - Carlos' blog

To receive data, however, there is one extra step, which I'll try to explain here. Like returning arbitrary data, the key for accepting arbitrary (in any format) data is for a method to have a parameter with type System.IO.Stream. This parameter needs to be the single parameter which is passed in the body of the request. By that we mean that the operation can have other parameters beside the Stream one, as long as they're used in the address (UriTemplate) for the operation.

For example, this program below will simulate an UploadFile operation: Notice that the (POST) HTTP request was sent to on the body of the request were the file contents. One important note about the line in bold about Content-Type: when returning arbitrary data, specifying the content type is advisable, but not (necessarily) required. Software Architecture – RESTful WCF Services for .Net Framework 4.0/Visual Studio 2010 « SoftArchitect.

Introducing WCF WebHttp Services in .NET 4 - The .NET Endpoint. This is a great series and gave me a great jump start on building a WCF REST service. I just wanted to post a few gotchas that I encountered when deploying to IIS 6. These mostly pertain to using routes (no svc file) so if you're using a svc these may not apply. 1. If you use routes you won't have an extension so you need to use a wildcard application map. - IMPORTANT: Make sure you select the 4 version of the aspnet_isapi.dll - IMPORTANT: When setting up the wildcard, make sure the checkbox for "Verify that file exists" is unchecked. Instructions for setting up the wildcard mapping can be found here (thanks to Maarten Balliauw for the great article): Developing a REST Web Service using C# - A walkthrough.

Download source code - 76.5 KB Objective The objective of this article is to create a REST Web Service using C# which will support CRUD operations on the exposed object.

Developing a REST Web Service using C# - A walkthrough

This article concentrates on building the Web Service from scratch using HttpHandlers, and will give a detailed understanding of operations that happen “under the hood”. There are many documents which talk about REST Web Services, but hardly any which gives a complete code walkthrough. This is just what I intend to do. Introduction REST stands for Representational State Transfer. In a nutshell, REST is based on the representation of resources. Example – Let us consider a Web Service that returns Employee information. So if we want to get Employee information, we send an HTTP GET on the object Employee rather than query a method like GetEmployee(). For further reading, see the References section at the end of the article. Why use REST? Let us consider a practical example. HTTP verbs Example: HTTP handlers. Posting data to a REST service using C# - Derik Whittaker. Where to start REST web service in C# or ASP.Net.