Give It A Rest(ful) web service

30
www.opencredo.com Give it a REST(ful web service) Russ Miles Monday, 25 January 2010

description

This talk takes a tongue-in-cheek look at the service integration space and frames REST as providing a set of features that will finally overcome some of the pain being continually felt in this space.

Transcript of Give It A Rest(ful) web service

Page 1: Give It A Rest(ful) web service

www.opencredo.com

Give it a REST(ful web service)

Russ Miles

Monday, 25 January 2010

Page 2: Give It A Rest(ful) web service

© 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

Page 3: Give It A Rest(ful) web service

© 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

Page 4: Give It A Rest(ful) web service

© 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

Page 5: Give It A Rest(ful) web service

© 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

Page 6: Give It A Rest(ful) web service

© 2009 Open Credo Ltd www.opencredo.com

What do we want from an integration approach?

Monday, 25 January 2010

Page 7: Give It A Rest(ful) web service

© 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

Page 8: Give It A Rest(ful) web service

© 2009 Open Credo Ltd www.opencredo.com

A short (and painful) trip through integration technologies...

Monday, 25 January 2010

Page 9: Give It A Rest(ful) web service

© 2009 Open Credo Ltd www.opencredo.com

IPC

“Look ma! It’s all just pipes...”

Monday, 25 January 2010

Page 10: Give It A Rest(ful) web service

© 2009 Open Credo Ltd www.opencredo.com

RPC

“Look ma! It’s all just objects!”

Monday, 25 January 2010

Page 11: Give It A Rest(ful) web service

© 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

Page 12: Give It A Rest(ful) web service

© 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

Page 13: Give It A Rest(ful) web service

© 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

Page 14: Give It A Rest(ful) web service

© 2009 Open Credo Ltd www.opencredo.com

Contract First Web Services?

“Still reinventing...”

Monday, 25 January 2010

Page 15: Give It A Rest(ful) web service

© 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

Page 16: Give It A Rest(ful) web service

© 2009 Open Credo Ltd www.opencredo.com

And the vendors got fat...

Monday, 25 January 2010

Page 17: Give It A Rest(ful) web service

© 2009 Open Credo Ltd www.opencredo.com

But all was not well in WS-ville...

Monday, 25 January 2010

Page 18: Give It A Rest(ful) web service

© 2009 Open Credo Ltd www.opencredo.com

And then came Roy Fielding...

Monday, 25 January 2010

Page 19: Give It A Rest(ful) web service

© 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

Page 20: Give It A Rest(ful) web service

© 2009 Open Credo Ltd www.opencredo.com

Haven’t we seen something like this before?

WWWMonday, 25 January 2010

Page 21: Give It A Rest(ful) web service

© 2009 Open Credo Ltd www.opencredo.com

Web apps are Web services (done right)

Monday, 25 January 2010

Page 22: Give It A Rest(ful) web service

© 2009 Open Credo Ltd www.opencredo.com

The key components of REST

• Resources• URIs• Uniform interface• Stateless• Representations

Monday, 25 January 2010

Page 23: Give It A Rest(ful) web service

© 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

Page 24: Give It A Rest(ful) web service

© 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

Page 25: Give It A Rest(ful) web service

© 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

Page 26: Give It A Rest(ful) web service

© 2009 Open Credo Ltd www.opencredo.com

Finally, some code!

Aren’t RESTful services hard to develop...?

Monday, 25 January 2010

Page 27: Give It A Rest(ful) web service

© 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

Page 28: Give It A Rest(ful) web service

© 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

Page 29: Give It A Rest(ful) web service

© 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

Page 30: Give It A Rest(ful) web service

© 2009 Open Credo Ltd www.opencredo.com

Thanks and Any Questions?

[email protected]

http://www.russmiles.com

Monday, 25 January 2010