Pageviews

Showing posts with label Web Services. Show all posts
Showing posts with label Web Services. Show all posts

Wednesday, September 4, 2013

Web Services



                                                       Web Services helps to make simple code,  a web application which can be accessed through any language. If there is need of synchronizing a .NET Based application with an application which was build in JAVA, by using the webservices in that Java Application it can be synchronized easily. The JAVA application will expose a WSDL file  (Web Service Description Language) for exposing the code remotely to a .NET based application. The WSDL file an XML file used as communication medium between these application. So in that way any application can communicate with numerous application independent of the platform (Linux, Windows, Macintosh, Android) and languages (Java, .Net, PHP).

In Simple, Web-Services are the secured way to access remote Data without exposing the client's code or any remote code.

For e.g: If you don't have any website's username and password (like yahoo mail)- now a days you can login using FACEBOOK credentials and Facebook will ask for permissions to provide credentials to YAHOO.Here yahoo is using a web-service to access the Facebook database and Facebook is giving access to Yahoo through web service remotely without exposing any data and code to Yahoo.

There are two ends in web Services :-  
First :  The Web Service Host where the actual code and data resides. 
Second : The web Service Client where the stubs(programs) are generated using the Web Service Host's URL or XML file also known as WSDL file (Web Service Description Language).

So in my Example here Facebook will be the Web Service Host and Yahoo being the Web Service Client.

How Web Services Work:

The four major components on which web services works are :

1. SOAP  : Simple Object Access Protocol. More on this: http://www.w3schools.com/soap/soap_intro.asp
2. HTTP   : Hyper Text Type Protocol : More on this : http://www.tutorialspoint.com/http/what_is_http.htm
3. WSDL  : Web Service Description Language : More on this http://www.tutorialspoint.com/wsdl/wsdl_introduction.htm
4. UDDI    : Universal Decsription Discovery and Integration. More on this : http://www.w3schools.com/wsdl/wsdl_uddi.asp


There are different ways to use Web - Services. The usage depends on requirements and also depends on the Hosting Server. The different types of web services are listed below

1. RestFul
2. SOAP Based

1. RestFul Web-Services:

 In the web services world, REpresentational State Transfer (REST) is a key design idiom that embraces a stateless client-server architecture in which the web services are viewed as resources and can be identified by their URLs. Web service clients that want to use these resources access a particular representation by transferring application content using a small globally defined set of remote methods that describe the action to be performed on the resource. REST is an analytical description of the existing web architecture, and thus the interplay between the style and the underlying HTTP protocol appears seamless.
The HTTP methods such as GET and POST are the verbs that the developer can use to describe the necessary create, read, update, and delete (CRUD) actions to be performed. Some may see an analogy to operations in SQL, which also relies on a few common verbs, as shown in Table 1. However, the REST style and HTTP protocol are mutually exclusive, and REST does not require HTTP.
                                          Image Courtesy : http://wink.apache.org/documentation/1.0/html/1%20Introduction%20to%20Apache%20Wink.html 

2. SOAP Based:

A SOAP-based design may be appropriate when
  • A formal contract must be established to describe the interface that the web service offers. The Web Services Description Language (WSDL) describes the details such as messages, operations, bindings, and location of the web service.
  • The architecture must address complex nonfunctional requirements. Many web services specifications address such requirements and establish a common vocabulary for them. Examples include Transactions, Security, Addressing, Trust, Coordination, and so on. Most real-world applications go beyond simple CRUD operations and require contextual information and conversational state to be maintained. With the RESTful approach, developers must build this plumbing into the application layer themselves.
  • The architecture needs to handle asynchronous processing and invocation. In such cases, the infrastructure provided by standards such as WSRM and APIs such as JAX-WS with their client-side asynchronous invocation support can be leveraged out of the box.