Am new to webservice, so can any one help me to identify exact difference between Web Service and WCF Service ?
Note: please don't refer links. Explain by your own with some examples. Basic difference enough.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Praveen NPosted Jun 2, 2014, 6:45 AM
WEB SERVICE :
To create and consume a web service by client we add a attribute on top a method which needs to consumed as [WebMethod] as shown below
[WebMethod]
public string DisplayData()
{
return "It's Web service";
}
now create a client application, right click on the solution add web reference. it creates a proxy at the client.
create the object of the proxy and call/invoke the method of the web service created.
Adding more to the Web Service:
1. Web service provide functionality using standard Protocol such as HTTP.
2. Per transaction you can have only web service
etc
WCF
Four Steps to Create First WCF Service
- Right-click on the project and select "Add" | "New Item..."
- From the Web tab choose WCF Service to add
- give the service the name "WCFService.svc".
Next you need to perform the following tasks:1. Create Service Contract- Interface
2. Expose EndPoint with MetaData
3. Implment Service
4. Consume Service
To create a Service Contract:
- Open IService.cs and add a method signature Getdata();
- Ensure the attribute of the Interface is set as "[ServiceContract]"
- Define the functions you want to create as part of the Contract
- Set the Attribute of the functions as "[OperationContract]"
IWCFService.csusing System.ServiceModel;
namespace DemoWCF
{
[ServiceContract]
public interface IWCF
{
[OperationContract]
string GetData();
}
}
Endpoints with Metadata
In this step expose Endpoints and the Metadata of the service. To do this open the Web.config file
<services>
<service name="DemoWCF.WCFService">
<endpoint address="" contract="DemoWCF.IWCFService" binding="basicHttpBinding"/>
<endpoint address="mex" contract="IMetadataExchange" binding="mexHttpBinding"/>
service>
services>
Implement Service
DemoWCF.svc.cs
namespace DemoWCF
{
public class WCFService: IWCFService
{
public string GetData()
{
String str = "WCF Service";
return str;
}
}
}
now we have created the Service and configured the Endpoint. Now you need to host the service, that's where one more difference and major advantage of WCF comes over web service.
WCF can be self hosted or we can host on IIS or we can even host on WAS.
There are many more differences(Security, bindings, contracts etc) which you can google it :)
Regards,
Praveen Nelge
Jayakumar BalasubramaniamPosted Jun 2, 2014, 7:26 AM
Jayakumar BalasubramaniamPosted Jun 2, 2014, 7:24 AM
Lakshmanan Sethu SankaranarayanPosted Jun 2, 2014, 6:50 AM
please check the link
http://msdn.microsoft.com/en-us/library/aa738737(v=vs.110).aspx
Rajagopalan R VPosted Jun 2, 2014, 6:47 AM
http://www.dotnet-tricks.com/Tutorial/wcf/cH1H200314-Difference-between-WCF-and-ASP.NET-Web-Service.html
http://dotnet.dzone.com/articles/10-differences-between-wcf-and
http://www.aspdotnet-suresh.com/2012/10/c-difference-between-aspnet-webservice.html0
http://www.codeproject.com/Articles/139787/What-s-the-Difference-between-WCF-and-Web-Services
Please Refer The Above Links They Are Clear With The Difference What U Asked For
With Regards......,
R.V.Rajagopalan