Today, I am going to explain, what are web service in .NET with advantages and uses.. I will also explain how web services came in picture and before web services which technology worked.
What is web service
Web Service is an application or we can say a standard way for interacting directly with other applications over the internet. It is a way to develop interoperable application over the internet.
Web Service can locate on same computer within same network or different computer with different network. Web service is protocol independent, language independent and platform independent. Web services support standard protocol and data format like HTTP, XML, and SOAP.
How web services came in picture
Before web service there were two more technologies in picture,
COM
COM is known as Component Object Model. It allows interacting two objects on the same computer or machine but application can be different. We cannot use different application located on different computer using COM. It was the limitation of COM.
DCOM
To remove limitation of COM, a new technology introduced known as DCOM. DCOM is short form of Distributed Component Object Model. Using DCOM we can access two different application or object on different computer but both applications must be on same network. This was the limitation of DCOM.
Web Service
To remove limitation of DCOM new interoperable technology came in picture known as Web service that allow us to interact with other object or application which is located on different network.
- using System;
- using System.Collections;
- using System.ComponentModel;
- using System.Data;
- using System.Linq;
-
- using System.Web;
- using System.Web.Services;
- using System.Web.Services.Protocols;
-
- using System.Xml.Linq;
-
- namespace StockService
- {
-
-
-
-
- [WebService(Namespace = "http://tempuri.org/")]
- [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
- [ToolboxItem(false)]
-
-
-
-
-
- public class Service1 : System.Web.Services.WebService
- {
- [WebMethod]
-
- public string HelloWorld()
- {
- return "Hello World";
- }
- }
- }
Advantage of web services
Web services use XML format message to interact with other system. Xml format is a standard way to communicate between two incompatible systems. Web service sent message over HTTP protocol. So, message reaches to any system over internet without being blocked by firewall.
What is WSDL
WSDL means Web Services Description Language. Web services description language tell to client what types of message it accept and what will be returned as an output. WSDL contain every detail of web services like what is communication protocol method name, data type used.
Reference
If you want to know more please click
here.
Thanks for reading this article, hope you enjoyed it.