Interview :: Web Services
A web service is used to communicate among various applications by using open standards such as HTML, XML, WSDL, and SOAP. You can build a Java-based web service on Solaris that is accessible from your Visual Basic program that runs on Windows. You can also use C# to develop new web services on Windows invokes from your web application that is based on Java Server Pages (JSP) and runs on Linux.
These are some of the important advantages of web services:
- Interoperability: With the help of web services, an application can communicate with other application developed in any language.
- Reusability: We can expose the web service so that other applications can use it.
- Modularity: With the help of web service, we can create a service for a specific task such as tax calculation.
- A Standard protocol for every application program: Web services use standard protocol so that all the client applications written in different languages can understand it. This Standard protocol helps in achieving cross-platform.
- Cheaper cost for communication: Web services uses SOAP over HTTP so that anybody can use existing internet for using web services.
There are two types of web services:
- SOAP - It is an XML-based protocol for accessing web services.
- RESTful - It is an architectural style, not a protocol.
Following is a list of main features of web services:
- It is available over the Internet or private (intranet) networks.
- It uses a standardized XML messaging system.
- It is not tied to any one operating system or programming language.
- It is self-describing via a common XML grammar.
- It is discoverable via a simple find mechanism.
These are some of the important disadvantages of SOAP web services:
- Slow - It uses XML format that must be parsed to be read and defines many standards that must be followed while developing the SOAP applications. So it is slow and consumes more bandwidth and resource.
- WSDL Dependent - It uses WSDL and doesn't have any other mechanism to discover the service.
The following list specifies the features of SOAP:
- SOAP is a communication protocol.
- SOAP communicates between applications.
- SOAP is a format for sending messages.
- SOAP is designed to communicate via Internet.
- SOAP is platform independent.
- SOAP is language independent.
- SOAP is simple and extensible.
- SOAP allows you to get around firewalls.
- SOAP developed as a W3C standard.
The WSDL stands for Web Services Description Language. It is an XML document containing information about web services such as method name, method parameter. The Client needs a data dictionary which contains information about all the web services with methods names and parameters list to invoke them for the web services. The Web Service Description Language bridge up this gap, by providing all necessary information to the client.
Some Important elements used in Web Services Description language are as follows:
: The message element in WSDL is used to define all different data elements for each operation performed by the web service. : The port type element is used to determine the operation which can be performed by the web service. This operation can have two messages one is input and the second one is the output message. : This element contains the used protocol.