Professional Documents
Culture Documents
What is REST?
Representational State Transfer Maps your CRUD actions to HTTP verbs
Action
Create Retrieve Update Delete
Verb
POST GET PUT DELETE
Why REST?
Simple, both conceptually and programmatically Simpler and cleaner than SOAP
SOAP Example
POST /InStock HTTP/1.1 Host: www.example.org Content-Type: application/soap+xml; charset=utf-8 Content-Length: nnn <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <soap:Body xmlns:m="http://www.example.org/stock"> <m:GetStockPrice> <m:StockName>IBM</m:StockName> </m:GetStockPrice> </soap:Body> </soap:Envelope>
REST Example
GET /stock/IBM HTTP/1.1 Host: www.example.org Accept: application/xml
SOAP Example 2
POST /InStock HTTP/1.1 Host: www.example.org Content-Type: application/soap+xml; charset=utf-8 Content-Length: nnn <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <soap:Body xmlns:m="http://www.example.org/stock"> <m:BuyStock> <m:StockName>IBM</m:StockName> <m:Quantity>50</m:Quantity> </m:BuyStock> </soap:Body> </soap:Envelope>
REST Example 2
POST /order HTTP/1.1 Host: www.example.org Content-Type: application/xml; charset=utf-8 <?xml version="1.0"?> <order> <StockName>IBM</StockName> <Quantity>50</Quantity> </order>
Retrieve
GET /resourceName/resourceId
Update
PUT /resourceName/resourceId
Delete
DELETE /resourceName/resourceId
Hibernate dependencies
Use cg-lib-nodeps
Questions?
The End
Sean is reachable at: iam@seanstoppable.com www.crazyorgenius.com @ssmith