RESTful WCF Service
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