A web service is a software application that works over the internet. A web service resides on the web server and is available for use over the internet. After we create a web service, we will have to upload it on to a web host. The web host will make available the Web service, to anyone over the internet. However, while developing a web service we need not upload it to the web server for the purpose of testing it. We can test the web service by using the local web server. We will discuss testing of a web service in detail under the topic 'creating and testing a web service'.
In the .Net world, web server is the Internet Information Server, frequently referred to as IIS. In the Linux world, the web server is the Apache server.
To work over internet, a web service software application includes a Web API which facilitates other software application to communicate with it. The web API lets applications like web applications, windows applications, mobile applications communicate with each other using XML, SOAP.
In some contexts, a web service is described as "Software-as-a service". SAS is an acronym for software as a service. The high cost of software applications has forced companies to think of providing alternative models and one of them is using the a software application as a pay and use service for a certain period of time or other parameters. However, we should note that there are hundreds of implementations of web service other than SAS.
One of the most important implementation of a web service is to integrate disparate heterogeneous software applications.
Working of web service.
Before creating a web service, let us know how a web service works.
A software application also referred to as the client application, running on a computer, requests a web server to run a web service.
The web service is also a software, with its own class and methods. The difference between these methods and the ones we create for developing a windows application is discussed later.
- A request by the client application constitutes construction and sending a SOAP request using HTTP to the web server.
- For a web service to work, the computer has to be connected to the internet.
- The web server hosts the class and its methods of a web service, for a client computer to request and use.
- Any client computer located any where in the world, with an internet connection can request and use the class and its methods of the web service.
When do we create a web service ?
We create a web service to integrate heterogeneous applications.
We create a web service when there is the need to connect applications from incompatible environments, such as Windows and UNIX, or .NET and J2EE. Web service support any programming language on any platform. A client environment can talk to any server environment using web services.
We create a web service when the Client Environment is Unknown.
We create a web service when we have little or no knowledge of the client application that is used to access the functionality. We do not need to worry about any compatibility issues, when using web service.
We create web services when there is a need for Multichannel Client Formats, such as browser clients, rich desktop clients, spreadsheets, wireless devices, interactive voice response (IVR) systems and other business applications. This is possible because, a web service returns data in XML, and XML can be transformed into any format to support different clients.
Why do we create a web service ?
We create a web service when we would like to use a particular functionality or functionalities in many business applications. By adding a web service to an application we can enhance the features of the application. Note that we can use a web service in windows applications, web applications, web sites and mobile applications.
To know more about "Why do we create a web service
" click here.
Technologies to create web service.
A web service is service-oriented application that communicates over the web using messages. Web services represent the convergence of three main technologies.
- The web
A Web service is a Web resource. It communicates over the internet using standard Web protocols. Leveraging the Web yields universal connectivity and pervasiveness.
XML is a language for electronic documents and messages. It provides a universal, self-describing data format that can be interpreted, processed, and transformed by any application running on any platform. Using XML results in heterogeneous platform support and application flexibility.
SOA describes a set of common practices for service-based applications. Most middleware technologies also rely on the SOA. SOA defines mechanisms for describing services, advertising and discovering services and communicating with services. Using SOA results in developer productivity and runtime efficiency.
To know more about "Technologies to create web service,
" click here.
Tools to create a web service.
Web service tools refers to the products we use to build and implement Web services. Here we will discuss the kind of software products that we can use to build, deploy, manage and use Web services. Web service products are implemented on XML, SOAP, WSDL,UDDI and other web services technologies.
To know more about "Tools to create a web service,
" click here.
How do we create a web service in Visual Studio.Net ?
Creating a Web service in Visual Studio .NET is easy. ASP.Net server side technology allows developers to create web services using the .NET framework. The .Net framework also provides a sophisticated set of tools and code to consume web services. With the .Net framework, we can only consume a web service. We need Visual Studio.net to create a web service.
To create a simple HelloWorld web service, we need to understand the technology behind the Web services like SOAP and WSDL.
Creating a new ASP.NET Web Service project in the programming language of our choice.
To know more about "How do we create a web service in Visual Studio.Net ?
" click here.
Testing. After we create a web service.
After we create a web service, we need to test it to verify that it does not have any errors and provides the required functionality. A Web Service does not have a interface for us to test. But the CLR will create a small interface, which looks like a site that enables us to test each method. When we run a web service project, Internet Explorer will come up, displaying the page containing a list of the methods as well as a link to the Service Description. The Service Description link provides a description of all the methods, such as the number of parameters and their data types, the sequence of the parameters, and the return value of the methods exposed by the Web service.(WSDL document)- Web services Description Language is a markup language, which is used to describe a Web service.
To know more about "Testing after creating a web service,
" click here.
Deploy a web service.
After we create a web service, we deploy it using a FTP program. A Web service exists as a .asmx file. So, it cannot be used as we use a .aspx page. This is because we cannot implement a user interface for a web service. Note that the output of a web service can be read by applications not by humans.
A web service also has dependencies, which are .dll files and also need to be deployed. A web service also includes .disco and .XSD (XML Schema Definition files) which need to be deployed.
To know more about "Deploy a web service,
" click here.
Consuming a web service by a client application.
A web service gives its output as a xml file which is used by the client application, such as browser based clients, rich desktop clients, spreadsheets, wireless devices, interactive voice response(IVR) systems and other business applications. Note that to consume a web service these applications should be able to read XML files.
To know more about "Consuming a web service by a client web application,
" click here.
When not to create a web service ?
A web service is not always the appropriate/correct solution. And also xml is not the most compact or efficient mechanism for transferring data.
Web services don´t provide a development component model, and therefore we don´t build complete applications using web services. We generally build applications using component technology based on a programming language, such as Java or Visual Basic. We use the native communication technology supplied by the language (for example, RMI or DCOM) to connect the various components within the application. We can then use Web services to expose the application functionality to other environments.