header image

Archive for 9532

RESTful WCF Service

Posted by: | July 8, 2009 | No Comment |

RESTful WCF Services works by identifing the Resources & Action from Uniform Resource Identifiers (URIs).

A RESTful web service is called by a unique URI to refer a resource and HTTP verb is to define actions to the resource.

HTTP Method – Verb
GET – Fetch
PUT – Update/Insert
DELETE – Delete
POST – Append

webHttpBinding is a new WCF binding in Fx 3.5 to develop RESTful services. This does not use SOAP envelopes HTTP and HTTPS Transports. It supports XML, JSON and Binary (streams).

WebServiceHost is a specialized SerivceHost which automatically configures address, binding, contract.
If no endpoint is defined, WebServiceHost automatically creates a default endpoint. WebServiceHost adds WebHttpBehavior and disables the HTTP Help page and the Web Services Description Language (WSDL) GET functionality.

[WebGet] And [WebInvoke] attribute
Binds a WCF operation to URI space and HTTP method Indicate the HTTP Method for the operation

WebGet – No method is require

WebInvoke – All verbs other than GET (Method parameter takes in the name of the Verb)

Other attributes can mentioed
BodyStyle – Indicates whether the Request/ Response are wrapped or not
RequestFormat – Json or Xml
ResponseFormat – Json or Xml

UriTemplate – Rich binding to URI UriTemplate String that allows define the structure/pattern of the URI

under: 9531, 9532, 9534


Posted by: | December 23, 2008 | No Comment |

The series blog post on REST in WCF

  • REST in WCF – Part I (REST Overview)
  • REST in WCF – Part II (AJAX Friendly Services, Creating The Service)
  • REST in WCF – Part III (AJAX Friendly Services, Consuming The Service)
  • REST in WCF – Part IV (HI-REST – Exposing a service via GET – Configuring the service)
  • REST in WCF – Part V (HI-REST – Exposing a service via GET – The ServiceContract and Implementation)
  • REST in WCF – Part VI (HI-REST – Consuming our GET service via AJAX)
  • REST in WCF – Part VII (HI-REST – Implementing Insert and Update
  • REST in WCF – Part VIII (HI-REST – Implementing Delete)
  • REST in WCF – Part IX – Controlling the URI
  • REST in WCF – Part X – Supporting Caching and Conditional GET
  • under: 9531, 9532, 9533, 9534

    Url Rewriting using WCF

    Posted by: | December 22, 2008 | No Comment |

    One of my interesting thing is “URL Rewriting”. The first time I have implemented it through implementing HTTPHandler using .NET 1.1. Same concept I have applied to a Document Management Service [DMS] project to PUT the document and GET the document by an .ASMX WebService. There I added verb * using wild charater in IIS 6.0 as well as added  <httpHandler> node in web.config. Then we got in different way in .NET 2.0. Finally this time we got using URITemplate, WebGet, WebInvoke in WCF 3.5 SP1.

    The UriTemplate class provides methods for working with sets of URIs that share a common structure for URL Rewriting.
    As this follows based on the URL pattern comprises left portion of URI which is fixed and rest is dynamic where certain parameter is getting manipulated or changed to request a page. System.UriTemplate provides runtime support for URI template syntax.
    UriTemplate is to manipulate parameters using ByName and ByPosition.
    [WebGet] – supports HTTP GET method
    WebOperationContext provides easy access to Web specifics (e.g., headers, status codes)
    [WebInvoke] supports other HTTP methods; POST is default method



    Corresponding to previous version’s URL concept the available resources are in





    under: 9532, 9533, 9534, 9535, 9536