Representational State Transfer (REST) support was included in WCF 3.5. In WCF 4.0, this feature has been enhanced with Help page support. This facility was added as WCF REST allows direct call to OperationContracts, using HTTP protocol by the client application. Now the problem is if the WCF service has several OperationContracts, then how does the client application know and distinguish between the urls for method calls? WCF 4.0 REST Help page enhancements provides this feature so that when the WCF service is published on the Web Server, the client application can decide which method to call using the help page and can also view the expected response message generated.
Step 1: Open VS2010 and create a WCF Service application, name it as ‘WCF_REST_POX_Service_Help’. Rename IService1.cs to IService.cs and Service1.svc to Service.svc. In the IService.Svc, add ServiceContract , OperationContract and DataContract, as shown below:
Step 2: In the web.config file, define the EndPointBehavior and define the HelpEnabled attribute for the <webHttp> as below:
Step 3: Right-Click on Service.Svc and select ‘View In Browser’, the following message will be displayed:
Click on the Service help Page and you will see the following
Click on the First Url and you can see an example of the response XML body. Very useful!