Thursday, March 27, 2014

Web Services Basics




Web Services..


Web services is any application (service) running on any platform, coded in any language which makes itself available over the internet, example a web site is available for end user consumption a web service is available for application consumption, basically applications irrespective of platform/programming language communicating with each other over the network/internet via the web services protocols.

Example an application coded in Java can call (communicate) a web service coded in .Net and vice-versa. Web Service is based on the use of Extensible Markup Language (XML). XML is designed to share, store, carry and exchange data and is not designed to display data. XML helps systems share structured data, is pervasive and is a language to share metadata.

XML is not restricted to web services only and is used widely in Web 2.0/AJAX. Majority of the software vendors now make available there applications via web services and the current trend is to eliminate the traditional client-server model and make the applications available to any subscriber (client) over http/https only.

The services shared via the web service is called a contract, this is provided as an XML document known as WSDL (Web Service Description Language), This WSDL document is shared with the external users, the customers.
As shown in the below diagram the application calls are first converted into a specific XML message and then transmitted over the network. The conversion of program calls/messages (in any language) to this XML message is done by SEI (Service Endpoint Interface).The data types exchanged between web services is in a specific XML format defined via SOAP (Simple Object Access Protocol). This SOAP message is sent over the network/internet to the web services provider.
In short the application calls are converted via SEI to SOAP which then uses WSDL to connect to the Web Services provider.

If any company wants to introduce their services to the public internet they do so by registering there
web services to UDDI (Universal Discovery Description and Integration), the UDDI is like a yellow pages for web services, any consumer just queries this registry, gets the requisite WSDL and uses that web service.


Web services communicates either via SOAP (more popular) or REST (Representational State Transfer) protocol, though there are differences in specifics but in general both provide the same functionality




In the above diagram, If Company A wants to subscribe to the Web Services of Company B, the application at Company A would call the specific function/method, the SEI would convert this call to a SOAP message and using the WSDL contract XML file will make a http/https POST request to the Web Service Endpoint at Company B, The Web Service EndPoint at Company B would then convert the SOAP message via SEI to format understood by the application at Company B and would then respond with the appropriate message, this response would again follow the same process as followed by Company A.

We can see that via Web Services an application coded in any language can communicate with application coded in any other language and vice-versa, all we need is the SEI to convert/de-convert the messages to/from SOAP and the Web Service Contract (WSDL) file in XML. The SEI basically runs on top your application and is transparent to the application.


With Web Services the operating system, programming languages, databases and any other proprietary protocols are no longer the stumbling blocks for sharing, integrating two or more disparate systems