Sunday 7 September 2014

HB Blog 17: Basics of Web Services.

Firstly, a very basic but an important question is what is a Web services?
A Web service is a method of communication between two electronic devices over a network.They are the integral part of Mobile development.
Web service are of various types SOAP, REST, and XML-RPC.
Have a look over below component diagram of web services,
There are 3 major interface Client,Server,Database.
  • Client can be anything mobile,browser,script .In short who can make a request to server is client.
  • Server can be any machine that have facility to execute server pages.All the web services files are stored at server.
  • Database is storing the data provided by client or already filled in.

Lets see, SOAP Vs REST Vs XML-RPC,

SOAP – "Simple Object Access Protocol"

  • Accessing a SOAP web service is super easy with any language that has SOAP libraries to help you.
  • All you have to do is point your code to the url of the web service’s WSDL, and you’re off and running, making remote calls as you would to a local object.
  • PHP5 has a SOAP library that will handle your client and server, but you have to create your own WSDL.

REST – "Representational State Transfer"

  • REST Web Services consist of using plain HTTP to make method calls and you get XML or JSON in response.
  • The RESTful way is to use GET, POST, PUT, and DELETE calls to implement CRUD (Create, Read, Update, Delete) operations on an object.
    • GET : Read
    • POST : Create
    • PUT : Update
    • DELETE : Delete
  • It accepts HTTP parameters, either in the query string request, or in the query string of a POST request.
  • REST style web services are what power AJAX applications. The browser makes a request to a REST web service via JavaScript’s XMLHttpRequest object. The browser then parses the xml and replaces elements in the page with the data.
  • REST is really quite simple. If you would like to connect to some REST Web Services below in article.

XML-RPC – "Remote Procedure Call uses XML"

  • XML-RPC protocol is really simple. You pass requests which contain the method name, and parameters formatted in xml that defines their data types. The response comes back with similar xml data.
  • XML-RPC servers are easier to implement than SOAP when using scripting languages such as php which have very loose data typing.
  • PHP-PEAR library that you use to handle XML-RPC client and server scripting.

No comments:

Post a Comment