I have 4+ experience and working as software Engineer with Hytech professionals India PVT ltd and also working as Consultant,Trainer,Blogger and Author on Microsoft technologies,Also I have Trained more than 500+ IT professionals.I have knowledge about Asp.net,C#,SQL,Project management,replication,MVC,WebApi,SSRS,PostMan,TFS,SVN,Swagger,WMI,Agile,SignalR,Angularjs,IIS configuration.
Wednesday, 1 February 2017

Part 44:Introduction To ASP.NET REST Web API And Drawbacks Of Web Services And WCF- Part One

   In this part of article we will learn about asp.net web API and why we need asp.net web API.Most of developers are think about use to web API but they are not aware about that ,that's why i have decided to write complete topic for asp.net web API.If you want to learn all about REST web API you should visit my all part of article.I am also going to explain about basic definition of web service ,WCF,and difference between them because of most of developers are confused why i am using if we have already WCF and web service is available in market.

  • What is web service ?
  • What is WCF ?
  • What is REST ?
  • What difference between SOAP and REST based services ?
  • What is difference between web service,WCF and Web API ? 
  • Introduction of web API and why web API become popular ? 
What is web services(.asmx) ?
Before web services remoting is used but there are many cons that's why web services replace remoting. "Web service is like a web based application which is normally a class containing  methods that could be used by other web based or window based applications. It  also follows a code-behind layer such as the  web pages, although its not containing a user interface."

 Web services is way to communicate between two different or same web based application using "webmethod".web services can be accessible from web based or window based applications.Web services is soap based and transforming data via xml.
 For more details about web services you can go through best article which is written by Vithal Wadje .

Drawback of web services,SOAP in Asp.net: 
  • Hosting dependency
  • Protocol dependency
  • Serialisation dependency 
  • Data transformation
And also there are more drawback which will resolved by WCF and Web API,for more details you can go on given link.

What is WCF(.svc) and why replace web services with WCF ?:
Preceding WCF, a .NET 2.0 web reference was made in the clients that went about as an intermediary that encouraged the correspondence with a Web Service. .NET3.5 acquainted another instrument with make these intermediaries that are likewise perfect with WCF server-side technologies.
  "Windows Communication Foundation (Code named Indigo) is a programming stage and runtime framework for building, arranging and conveying system appropriated administrations. It is the most recent administration arranged innovation; Interoperability is the major qualities of WCF. It is bound together programming model gave in .Net Framework 3.0. WCF is a joined element of Web Service, Remoting, MSMQ and COM+. WCF gives a typical stage to all .NET correspondence. you can transfer information as asynchronous messages from one endpoint to another endpoint."
For more details all about WCf go through on given link. http://wcftutorial.net/

What REST ?
REST is stand for Representational State Transfer. (Sometime we can say "ReST".) Its a stateless, client-server, cacheable based protocol to communicate -- and in virtually all points, the HTTP protocol is using.REST is an architecture style for designing networked applications. 

 Actually By REST we can create web api using multiple verbes e.g GET,POST,PUT,DELETE and endpoint will looks like this. 

GET /GetData?id=2
POST /SaveData?id=2
PUT /UpdateData?id=1052&review_id=2
DELETE  /DeleteDataByID?id=2
For more details about REST go through given link.

What difference between SOAP and REST based services ?:
1.     REST supports multiples verbes over http's (GET,POST,PUT,DELETE)
2.   Soap is xml based protocal  whereas REST is architectural based.
3.   WDSL use to communicate between client and server. where as REST use XML or JSON.
4.   Service is  calling by RPC method whereas REST called by direct URL.
5.   Web services is not return human readable data whereas REST returns JSON data. 
6.   REST is easy to consume whereas soap is some complicated.
7.   REST is 5 times faster than soap.
8.   REST transfering data via HTTP. 
9.     REST is stateless and allow to cache. 
 What is difference between web service,WCF and Web API ?
Now i am  going to explain differences between web services ,wcf and Web api. actually i am trying to explain about scope of latest technologies.
  • Web services is soap based and return xml data whereas wcf is also same as but web api can be return json data. 
  • Web services is support only HTTP protocal whereas WCF support multiple (TCP,named pipe,p2p,etc..) and Web api can be use from any where.
  • Web Api can be consumed from any where or any plateform but web services can not.
  • Web services can be hosted on IIS but wcf and can be anywhere,Web Api can be on IIS and self.
  • We can use self hosting in wcf and WebApi but not allow in web services.
For more details you can go through given links.

Introduction of web API and why web API become popular ?
    Web Api stands for "Application programming interface" its a open source and rich framework of ASP.NET. Asp.net WebApi is following MVC pattern architecture like controller,routing,action,filter,model binder,etc...Web API area is so broad because it can be consumed from anywhere any plateform any browser.Its totally independent like can be accessible from Mobile,tablet,android,window.etc..

According this image we can easily understand Web API can be consumed from anywhere.
1.It supports  CRUD based action  with HTTP verbs GET,POST,PUT and DELETE.
2.Response with status code.
3.Webapi support MediaTypeFormatter  like multipart/formdata.
4.Easy to create and consume. 

I hope you all learn lot of thinks why we are using web API and some drawback of web services and wcf ,So actually i have decided to write all about web API from a-z step by step in different different part. 
In this article i have written only introduction part of Web api ,To more about web api wait.. for part 2 with example.  

Bikesh Srivastava WEB API

Life Is Complicated, But Now programmer Can Keep It Simple.