Learning Video on Creating basic WCF REST Service

Full source code for your reference is as below,

IService1.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Runtime.Serialization;

using System.ServiceModel;

using System.ServiceModel.Web;

using System.Text;

namespace WcfService3

{

[ServiceContract]

public interface IService1

{

[OperationContract]

[WebGet]

string GetDataUsingMethod(string value);

[OperationContract]

[WebGet(UriTemplate=“/GetData/{value}”)]

string GetDataUsingURI(string value);

}

}

Service1.svc.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Runtime.Serialization;

using System.ServiceModel;

using System.ServiceModel.Web;

using System.Text;

namespace WcfService3

{

public class Service1 : IService1

{

public string GetDataUsingMethod(string value)

{

return value + “I am returned by Method Name “;

}

public string GetDataUsingURI(string value)

{

return value + “I am returned by URI Name “;

}

}

}

Markup of Service1.svc

I hope this post was useful. Happy Coding


Discover more from Dhananjay Kumar

Subscribe to get the latest posts sent to your email.

Published by Dhananjay Kumar

Dhananjay Kumar is founder of NomadCoder and ng-India

6 thoughts on “Learning Video on Creating basic WCF REST Service

  1. Why did you call it REST service?? you did not import WcfRestService1.dll to your project. Will it communicate with php or WorldPress services? W/o the proper implementation of REST service it will communicate with ASP.NET only.
    Thx Steve

  2. Hi Steve ,

    It is REST Service because we are using webHttpBinding . and in this case webServiceHostFactory. and Yes THis can be consumed in PHP and JAVA Provided need to make HTTP call of this service

  3. Dear Dhananjay
    Watched your good video that is getting as simple approach as possible to implement web service

    I just try to understand
    According your last statement/answer to Steve – The definition of the REST Service is “Any Service (WCF?) that uses webHttpBinding ‘is’ the REST service” (More precise: The WCF service with REST protocol).
    In this case may be your next video would be an evidence video that the project REST service consumes PHP and Java web services, but w/o adding WCFserviceREST Reference to your project! Another word: C:\dir WCFserviceREST.dll /s suppose to show file not found on your machine.

    Thanks, Steve

  4. This is awsome. realy a simple and easy to understand.how i can get more videos of similar..

Leave a comment

Discover more from Dhananjay Kumar

Subscribe now to keep reading and get access to the full archive.

Continue reading