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

Advertisements

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s