using System.ServiceModel.Web; namespace RestWcfGetname { // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IRestFullService" in both code and config file together. [ServiceContract] public interface IRestFullService { [OperationContract] [WebInvoke(Method = "Get", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "json/id")] string GetPassedName(string id); [OperationContract] [WebInvoke(Method = "Get", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "")] string GetName(); } }
using System.ServiceModel; using System.Text; namespace RestWcfGetname { // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "RestFullService" in code, svc and config file together. public class RestFullService : IRestFullService { #region IRestFullService Members public string GetPassedName(string id) { return "i am from wcf service " + id; } public string GetName() { return "Hi Welcome to WCF Service"; } #endregion } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)