restful web services l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
RESTFul Web Services PowerPoint Presentation
Download Presentation
RESTFul Web Services

Loading in 2 Seconds...

play fullscreen
1 / 13

RESTFul Web Services - PowerPoint PPT Presentation


  • 179 Views
  • Uploaded on

RESTFul Web Services. The Easy Way. What is REST?. Representational State Transfer Maps your CRUD actions to HTTP verbs. Why REST?. Simple, both conceptually and programmatically Simpler and cleaner than SOAP. SOAP Example. POST /InStock HTTP/1.1 Host: www.example.org

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

RESTFul Web Services


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
what is rest
What is REST?
  • Representational State Transfer
  • Maps your CRUD actions to HTTP verbs
why rest
Why REST?
  • Simple, both conceptually and programmatically
  • Simpler and cleaner than SOAP
soap example
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
REST Example

GET /stock/IBM HTTP/1.1

Host: www.example.org

Accept: application/xml

soap example 2
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:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Bodyxmlns: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
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>

single resource summary
Single Resource Summary
  • Create
    • POST /resourceName
  • Retrieve
    • GET /resourceName/resourceId
  • Update
    • PUT /resourceName/resourceId
  • Delete
    • DELETE /resourceName/resourceId
making it easy jsr 311
Making it Easy: JSR 311
  • JAX-RS: The Java API for RESTful Web Services
  • No XML Configuration!
    • Simple annotations to quickly put together some rest based web services.
  • Can do automatic serialization (both XML and JSON + many others)
some rest jersey jaxb gotchas
Some REST/Jersey/JAXB Gotchas
  • No real security standard for REST.
    • Mostly DIY solutions
  • Hibernate dependencies
    • Use cg-lib-nodeps
the end
The End

Sean is reachable at:

  • iam@seanstoppable.com
  • www.crazyorgenius.com
  • @ssmith