Tuesday, August 26, 2008

Web Service in Restful way

Principles of REST Web Service Design

1. Identify all possible conceptual entities that we want to expose as web services. Everything is a consider the resource that will make available as services.

2. Each resource should has its own URI and identify the resources by a noun not a verb

Incorrect: http://www.parts-depot.com/parts/getPart?id=00345

Correct: http://www.parts-depot.com/parts/00345

3. Categorize the resources so that the client can receive a representation of of resource or they can modify it. At the initial state, make those resources accessible using an HTTP GET, Then using HTTP POST, PUT, and/or DELETE for modification states.

4. Resource that is accessible through HTTP GET should just return a representation of the resource. The invocation of the resource should not result in modifying the resource.


5. No resource should be placed in isolation, but hyperlinks (href), so the user can drill down to detail information or at least to the related information.

6. Don't put all resources in a single show room. Provide hyperlinks to obtain more details resources.

7. Specify the format of response data using a specific schema (DTD, W3C Schema, RelaxNG, or Schematron). For those services that require a POST or PUT to it, also provide a schema to specify the format of the response.


8. Describe how your services are to be invoked using either a WSDL document, or simply an HTML document.

No comments: