Synopses & Reviews
"Every developer working with the Web needs to read this book."-- David Heinemeier Hansson, creator of the Rails framework
"RESTful Web Services finally provides a practical roadmap for constructing services that embrace the Web, instead of trying to route around it."-- Adam Trachtenberg, PHP author and EBay Web Services Evangelist
You've built web sites that can be used by humans. But can you also build web sites that are usable by machines? That's where the future lies, and that's what RESTful Web Services shows you how to do. The World Wide Web is the most popular distributed application in history, and Web services and mashups have turned it into a powerful distributed computing platform. But today's web service technologies have lost sight of the simplicity that made the Web successful. They don't work like the Web, and they're missing out on its advantages.
This book puts the "Web" back into web services. It shows how you can connect to the programmable web with the technologies you already use every day. The key is REST, the architectural style that drives the Web. This book:
- Emphasizes the power of basic Web technologies -- the HTTP application protocol, the URI naming standard, and the XML markup language
- Introduces the Resource-Oriented Architecture (ROA), a common-sense set of rules for designing RESTful web services
- Shows how a RESTful design is simpler, more versatile, and more scalable than a design based on Remote Procedure Calls (RPC)
- Includes real-world examples of RESTful web services, like Amazon's Simple Storage Service and the Atom Publishing Protocol
- Discusses web service clients for popular programming languages
- Shows how to implement RESTful services in three popular frameworks -- Ruby on Rails, Restlet (for Java), and Django (for Python)
- Focuses on practical issues: how to design and implement RESTful web services and clients
This is the first book that applies the REST design philosophy to real web services. It sets down the best practices you need to make your design a success, and the techniques you need to turn your design into working code. You can harness the power of the Web for programmable applications: you just have to work with the Web instead of against it. This book shows you how.
This easy-to-understand reference shows how to use the Representational StateTransfer Web architecture, or REST, to provide services over the Web that arefundamentally simple, both for producers and the consumers.
About the Author
Jim Webber is the SOA practice lead for ThoughtWorks where he works on dependable service-oriented systems. Jim was formerly a senior researcher with the UK E-Science programme where he developed strategies for aligning Grid computing with Web Services practices and architectural patterns for dependable Service-Oriented computing. Jim has extensive Web Services architecture and development experience as an architect with Arjuna Technologies and was the lead developer with Hewlett-Packard on the industry's first Web Services Transaction solution. Jim is an active speaker in the Web Services space and is co-author of the book "Developing Enterprise Web Services - An Architect's Guide." Jim holds a B.Sc. in Computing Science and Ph.D. in Parallel Computing both from the University of Newcastle upon Tyne. His blog is located at http://jim.webber.name.
Savas Parastatidis is a Developer in Microsoft's Technical Computing Cloud group, working on a platform for large scale data- and compute-intensive technologies. Previously he was part of Microsoft's Bing group where he focused on semantic and knowledge representation technologies. He also spent time in Microsoft Research where he led the design and implementation of a number of tools for scientists and a platform for semantic computing applications called Zentity. He originally joined Microsoft as part of the architecture team in the Connected System Division doing the initial work for the Oslo (M language) modeling platform. Prior to joining Microsoft, Savas was a Principal Research Associate at the University of Newcastle where he undertook research in the areas of distributed, service-oriented computing and e-Science. He was also the Chief Software Architect at the North-East Regional e-Science Centre where he oversaw the architecture and the application of Web Services technologies for a number of large research projects. Savas also worked as a Senior Software Engineer for Hewlett Packard where he co-lead the R&D effort for the industry's Web Service transactions service and protocol. Savas' blog is located at http://savas.me.
Ian Robinson is a Principal Consultant with ThoughtWorks, where he specialises in helping clients create sustainable service-oriented development capabilities that align business and IT from inception through to operation. He has written guidance for Microsoft on implementing service-oriented systems with Microsoft technologies, and has published articles on business-oriented development methodologies and distributed systems design - most recently in The ThoughtWorks Anthology (Pragmatic Programmers, 2008). He presents at conferences worldwide on RESTful enterprise integration and distributed systems design and delivery.
Table of Contents
Foreword; Preface; The Web Is Simple; Big Web Services Are Not Simple; The Story of the REST; Reuniting the Webs; What's in This Book?; Administrative Notes; Conventions Used in This Book; Using Code Examples; Safari® Enabled; How to Contact Us; Acknowledgments; Chapter 1: The Programmable Web and Its Inhabitants; 1.1 Kinds of Things on the Programmable Web; 1.2 HTTP: Documents in Envelopes; 1.3 Method Information; 1.4 Scoping Information; 1.5 The Competing Architectures; 1.6 Technologies on the Programmable Web; 1.7 Leftover Terminology; Chapter 2: Writing Web Service Clients; 2.1 Web Services Are Web Sites; 2.2 del.icio.us: The Sample Application; 2.3 Making the Request: HTTP Libraries; 2.4 Processing the Response: XML Parsers; 2.5 JSON Parsers: Handling Serialized Data; 2.6 Clients Made Easy with WADL; Chapter 3: What Makes RESTful Services Different?; 3.1 Introducing the Simple Storage Service; 3.2 Object-Oriented Design of S3; 3.3 Resources; 3.4 HTTP Response Codes; 3.5 An S3 Client; 3.6 Request Signing and Access Control; 3.7 Using the S3 Client Library; 3.8 Clients Made Transparent with ActiveResource; 3.9 Parting Words; Chapter 4: The Resource-Oriented Architecture; 4.1 Resource-Oriented What Now?; 4.2 What's a Resource?; 4.3 URIs; 4.4 Addressability; 4.5 Statelessness; 4.6 Representations; 4.7 Links and Connectedness; 4.8 The Uniform Interface; 4.9 That's It!; Chapter 5: Designing Read-Only Resource-Oriented Services; 5.1 Resource Design; 5.2 Turning Requirements Into Read-Only Resources; 5.3 Figure Out the Data Set; 5.4 Split the Data Set into Resources; 5.5 Name the Resources; 5.6 Design Your Representations; 5.7 Link the Resources to Each Other; 5.8 The HTTP Response; 5.9 Conclusion; Chapter 6: Designing Read/Write Resource-Oriented Services; 6.1 User Accounts as Resources; 6.2 Custom Places; 6.3 A Look Back at the Map Service; Chapter 7: A Service Implementation; 7.1 A Social Bookmarking Web Service; 7.2 Figuring Out the Data Set; 7.3 Resource Design; 7.4 Design the Representation(s) Accepted from the Client; 7.5 Design the Representation(s) Served to the Client; 7.6 Connect Resources to Each Other; 7.7 What's Supposed to Happen?; 7.8 What Might Go Wrong?; 7.9 Controller Code; 7.10 Model Code; 7.11 What Does the Client Need to Know?; Chapter 8: REST and ROA Best Practices; 8.1 Resource-Oriented Basics; 8.2 The Generic ROA Procedure; 8.3 Addressability; 8.4 State and Statelessness; 8.5 Connectedness; 8.6 The Uniform Interface; 8.7 This Stuff Matters; 8.8 Resource Design; 8.9 URI Design; 8.10 Outgoing Representations; 8.11 Incoming Representations; 8.12 Service Versioning; 8.13 Permanent URIs Versus Readable URIs; 8.14 Standard Features of HTTP; 8.15 Faking PUT and DELETE; 8.16 The Trouble with Cookies; 8.17 Why Should a User Trust the HTTP Client?; Chapter 9: The Building Blocks of Services; 9.1 Representation Formats; 9.2 Prepackaged Control Flows; 9.3 Hypermedia Technologies; Chapter 10: The Resource-Oriented Architecture Versus Big Web Services; 10.1 What Problems Are Big Web Services Trying to Solve?; 10.2 SOAP; 10.3 WSDL; 10.4 UDDI; 10.5 Security; 10.6 Reliable Messaging; 10.7 Transactions; 10.8 BPEL, ESB, and SOA; 10.9 Conclusion; Chapter 11: Ajax Applications as REST Clients; 11.1 From AJAX to Ajax; 11.2 The Ajax Architecture; 11.3 A del.icio.us Example; 11.4 The Advantages of Ajax; 11.5 The Disadvantages of Ajax; 11.6 REST Goes Better; 11.7 Making the Request; 11.8 Handling the Response; 11.9 JSON; 11.10 Don't Bogart the Benefits of REST; 11.11 Cross-Browser Issues and Ajax Libraries; 11.12 Subverting the Browser Security Model; Chapter 12: Frameworks for RESTful Services; 12.1 Ruby on Rails; 12.2 Restlet; 12.3 Django; Some Resources for REST and Some RESTful Resources; Standards and Guides; Services You Can Use; The HTTP Response Code Top 42; Three to Seven Status Codes: The Bare Minimum; 1xx: Meta; 2xx: Success; 3xx: Redirection; 4xx: Client-Side Error; 5xx: Server-Side Error; The HTTP Header Top Infinity; Standard Headers; Nonstandard Headers; Colophon;