26 March 2014

RESTful service

      "REST, an architectural style for building distributed hypermedia driven applications, involves building Resource-Oriented Architecture (ROA) by defining resources that implement uniform interfaces using standard HTTP verbs (GET, POST, PUT, and DELETE), and that can be located/identified by a Uniform Resource Identifier (URI)."

Any Service which follows this REST architecture style is called as RESTful service. It became very popular because of it behavior, it is similar to the website i.e we can load the server information using web URL  n the browser. Similarly we can also access/modify the server resource using URL in RESTful service
  • RESTful service will allow the client (written in different language)to access or modify the resource in the server using URL.
  • RESTful service uses the http protocol for its communication and it is stateless
  • RESTful service can transfer the data in XML,JSON,RSS,ATOM  
  Implementing REST Service


SOAP
POX(plain-old XML)
REST
  • Simple Object Application Protocol
  • SOAP – is a package contain message information and it will be delivered by HTTP
  • Developers are mainly preferred to user because of its increase interoperability
  • Lot of tools are available in the market to generate the clients code from WSDL
  • Plain raw XML message will be used for communication
  • Developers using POX had to write their own code for XML and HTTP for request/response message.
  • So most of the developers moved back to SOAP
  • REST defines more of a transport-specific model
  • In reality HTTP is the only protocol that is used in practice today for building RESTful architecture.

       This basic REST design principle establishes a one-to-one mapping between create, read, update, and delete (CRUD) operations and HTTP methods. According to this mapping
  • To create a resource on the server, use POST.
  • To retrieve a resource, use GET.
  • To change the state of a resource or to update it, use PUT.
  • To remove or delete a resource, use DELETE.
     RESTful service can be created by using WebGetAttribute and WebInvokeAttribute attribute. RESTful service has provided separate attribute for GET operation (Web Get) because it want to make use of complete features. Other operations like POST, PUT, and DELETE will come under the Web Invoke attribute.

No comments:

Post a Comment