Give It A Rest(ful) web service
-
Upload
opencredo -
Category
Technology
-
view
755 -
download
2
description
Transcript of Give It A Rest(ful) web service
www.opencredo.com
Give it a REST(ful web service)
Russ Miles
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Agenda
• What do we want from an integration approach?
• A trip through history...• What’s REST?• Why REST?• That’s gotta be difficult to implement...• Summary
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
First a BIG PLUG!
RESTful Web Services by O’ReillyGo buy this book, now! (Ok, or borrow it off of me)
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Who the heck is Russ Miles?
• Author and Technical Editor– AspectJ Cookbook– Learning UML 2.0– Head First Software Development
• OpenCredo– CEO– Consultant
• And in other lives...– Search– Mobile– Defence– Open Source
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Who the heck is Russ Miles?
• Author and Technical Editor– AspectJ Cookbook– Learning UML 2.0– Head First Software Development
• OpenCredo– MD– Consultant
• And in other lives...
–Search– Mobile– Defence
–Open Source
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
What do we want from an integration approach?
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Some of the things we’ve been promised
• Platform/language/framework agnostic• Scaleable• Evolvable• Secure• Simple (or as simple as possible)• Open Standards
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
A short (and painful) trip through integration technologies...
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
IPC
“Look ma! It’s all just pipes...”
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
RPC
“Look ma! It’s all just objects!”
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
IPC/RPC... sucks (between apps/systems)
• Cannot easily evolve• Doesn’t scale to the ‘new’ integration
challenge• Is brittle
– (Stateless? Scalable? I think not...)• Is ‘interesting’ when it comes to multiple
languages/frameworks...• Tries to solve the WRONG problem
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Web Services to save the day...
“It’s time to reinvent that wheel boy!”
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
RPC Web Services sucked
• Framework and Language nuances• Encouraged worst practices• RPC is the essential problem here!
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Contract First Web Services?
“Still reinventing...”
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Contract First, Document Literal, Web Services tried to help
• XML is the lingua franca!• Transport agnostic• Contract first!• SOAP and WSDL• WS-Addressing• WS-Policy• WS-Security• Ummm WS-WhateverYouLike!
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
And the vendors got fat...
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
But all was not well in WS-ville...
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
And then came Roy Fielding...
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Representational State Transfer
• Think in ‘things’• Things have addresses• Things have representations you can GET• Things can be PUT back differently• Things can be DELETEd• Things can be, umm, POSTed to create
them• Does anyone see this as anything new...?
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Haven’t we seen something like this before?
WWWMonday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Web apps are Web services (done right)
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
The key components of REST
• Resources• URIs• Uniform interface• Stateless• Representations
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
But WHY?!
• Simple to implement• Systems are naturally broken down into
Resources...• Naturally HTTP, not abusing HTTP...• Scales like a western man on 40
hamburgers a day!
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
And now an apology...
• Not all systems that claim RESTfulness, are actually RESTful...
• XML over HTTP isn’t the same– unless you mean the same as web services...
• The URL matters (dammit!)• The mime type matters• The HTTP method (really) matters!
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
You need to think about REST
• Decide on resources• Decide on URIs• Decide on methods you’ll support• Decide on how resources will relate
(hypermedia, WADL, both?)• Decide on representations you’re going to
support
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Finally, some code!
Aren’t RESTful services hard to develop...?
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Summary
• RESTful services are ubiquitous• REST is actually very simple• Think about resources up front• Keep things stateless• The uniform interface unlocks the power of
the web for your internal services• Implementation is simple
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Some of the things we’ve been promised
• Platform/language/framework agnostic• Scaleable• Evolvable• Secure• Simple (or as simple as possible)• Open Standards
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Some of the things that REST delivers
• Platform/language/framework agnostic• Scaleable• Evolvable• Secure• Simple (or as simple as possible)• Open Standards
Monday, 25 January 2010
© 2009 Open Credo Ltd www.opencredo.com
Thanks and Any Questions?
http://www.russmiles.com
Monday, 25 January 2010