Web Services are typically services offered through web via exchange of XML data. A client makes a request call and server provides a response for the service call. This does not have a GUI it is mainly used for exchanging business logic. This is similar to the services provided by Object Management Group’s Common Object Request Broker Architecture (CORBA), Microsoft’s Distributed Component Object Model (DCOM), Sun’s Java Remote Method Invocation (RMI)
The Web Services uses the following components/protocols
XML – eXtensible Mark-up Language, used for defining the request and response data.
SOAP – Simple Object Access Protocol, a platform independent protocol used by the client and sever to make a Remote Procedure Call (RPC)
WSDL – Web Services Definition Language, describes the service and its operations
UDDI – Universal Description Discovery and Integration, for listing the web services.
Key Features of Web Services
- Can be accessed via Web
- Interoperable – Services can be accessed irrespective of the programming language or Operating System
- XML Communication – It is simple and less time consuming.
- Supports loosely coupled connections.
To get a better understanding of a web service, we can look at the stock quote web service available here (http://www.webservicex.net/stockquote.asmx)
This web service provides share price for a given stock quote. To see the Web Service Definition Language the URL needs to appended with ?wsdl
WSDL for stock quote web service looks as shown below
The WSDL provides the services description like the operations details(GetQuote) provided by the Stock Quote Service. Let us check this with by making a request for stock symbol GOOG (Google)
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.webserviceX.NET/">
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<AnnRange>247.30 - 591.19</AnnRange>
The above the SOAP Request makes a service call for the stock symbol GOOG and SOAP Response provides the stock details such as Last Price, Low, high, Change, Previous Close etc.