It is a technology introduced by Microsoft in .NET to provide distributed services over network.
Web Service performs the distribution of the logic always in a xml standard.
To develop distributed services many technologies are available in the market like DCOM, CORBA, RMI etc. before .NET
- Easy to develop and use
- Cross application communication
- Cross platform Communication
- Cross Language Communication
- Supports Firewalls for Security reasons
Standards of Web Services
SOAP (Simple Object Access Protocol)
- This standard is used for data transformation and data conversion.
- It contains XML which is the universal understandable format which is used for transferring the request and response in XML format which is called as SOAP Envelope.
- To take the SOAP Envelope b/w client and service universal communication protocol is used i.e. HTTP
- Because its port number is configure on most of the firewalls and proxy.
WSDL (Web Service Description language)
- This standard will describe a web service in an XML Schema.
- It provides the description about the methods available, method parameters list, type and the return type of the method.
- It also specifies how the request and responses are perform with the protocols along with the path of a web service.
DISCO (Discovery Standards)
- This file will maintains the links of WSDL.
UDDI (Universal Discovery Description Integration)
- It is a centralized repository where all the web services links are maintained in terms of discovery files. (www.UDDI.org)
- When a Client app gives a request it will search the web service and the WSDL file of that web service and the WSDL file of that web service is return back to the client program.
- The client program give the WSDL file to proxy class which checks the your request in the description and generates the request object by binding, parameter list, Type and return type.
- Request object is converted to XML standard which is called SOAP request Envelope.
- SOAP request Envelope is transfer to server using http protocol
- The Soap server on the web server will accept the soap request envelope and converts it to an ordinary request object then forward into the web services.
- Web service will process the request and gives the response to the SOAP server.
- SOAP server will convert the response to SOAP response envelope send it back to the client using http protocol.
- The proxy class on the client machine converts the SOAP response object to display the output.
- When a client wants to search a web service or access a web service the request is first accepted by the UDDI server.
- UDDI contains that web service discovery files.
- UDDI server choose the discovery file according to the request and return the link of WSDL file to the client.
- The client program will give the request to the WSDL file. Then web service will returns the WSDL file to the client.
- Remaining steps are same as Local Architecture.
Developing Web Service in ASP.NET
- Web Services are stateless
- They should save with .asmx(Active Server Method extension) extension.
- The method which you want to provide for internet accessibility those should be declare with [WebMethod] attribute.
- To develop web service in ASP.NET, .NET framework has provided System.Web.Services namespace.
Developing a Web Service in Notepad
<%@ WebService Language=“C#” Class=“Sample”%>
public class Sample
public int Sum(int a, int b)
- Save the file with .asmx extension and copy the file to the virtual directory.
- To test the WebService and to view the description go to browser and type the url of the like ex: http://localhost/aspnet/first.asmx
State Management with Web Services
- As Web Services are stateless technology whose memory will be allocated with every request and automatically destroys with every response.
- So to maintain some information on the web service hosted system for a specific time interval we can use state management.
- State management with web service always supports Server Side State management by using 3 concepts
1. Sessions 2. Applications 3. Caching
Sessions with Web Service:
- Session is some information maintained on a server machine with a default life span of 20 minutes after sending the response.
- It is local for every user.
- Session along with Web Services are by default disable so to use the session we should enable it for every Web Method.
Application object with Web Service:
- It is similar like session maintaining information on server for life span of 5 minutes after sending the response.
- It is sharable among more than one user.
Caching with Web Service:
- Caching is use to maintain some data, output of webpage in a fast accessing temporary memory i.e. caching memory.
Security with Web Services
- If the web service placed under UDDI server anybody can access your web services.
- So the UDDI server requires registration before access the web services from it. And to provide the communication between UDDI server and application we require passport services.
- In .NET 1.1 version the passport services need to install by downloading from http://www.hotmail.com or http://www.ms.com and then we need to specify authentication, authorization settings in application web.config file.
- In the Web.Config file
<authentication mode = “Passport”>
<Passport redirecturl = “ ”/>
- From .NET 2.0 version onwards passport services are by default integrated and also they are configured on IIS.