Restful Web Services (英語) ペーパーバック – 2007/5
Kindle 端末は必要ありません。無料 Kindle アプリのいずれかをダウンロードすると、スマートフォン、タブレットPCで Kindle 本をお読みいただけます。
"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.
Leonard Richardson has been programming since he was eight. Recently the quality of his code has improved somewhat. He is responsible for libraries in many languages, including Rubyful Soup. A California native, he now works in New York. He maintains a website at http://www.crummy.com/. Sam Ruby takes a perverse pleasure in integrating disparate things. He is a Vice President of the Apache Software Foundation, chairman of the Jakarta project, member of the XML PMC. He is an officer of ECMA and convener of the TC39 group standardizing the CLI for DotNet. He is a member of the PHP group, and developer on the Apache Soap and Bean Scripting Framework projects. He is currently employed by IBM.
I do think he could have covered more about what to do with large return data sets -- he briefly mentioned using a page arg in the query string, like google's search results uses, and returning "next" link in the response to help the client know how to get to the next page. But, he also says an Atom feed is a good way of providing lists of other resources, although an Atom feed doesn't provide a paging mechanism nor a way to link to the next page at the end of your current page. I wish he took these concepts further to suggest to the developer how he could provide paging of large returned data sets that you'd typically have with collections of a large number of resources of a particular type.
One thing he did not touch on at all was the disagreement out there on whether a PUT to an existing resource should always completely replace the entire resource, or modify just the properties of that resource that were sent in the body of the PUT, or some combination of both. I lean towards a PUT defaulting to replacing the entire resource (or failing if you're not allowed to replace a resource), and optionally using query string args to control how the existing resource is modified. If you look at the growing OSLC specifications, their strategy is to have query strings that say which properties are being updated for an existing resource.
And, if a PUT is updating an existing resource, you'd want to do a GET of it first, remember the ETag, then do a PUT while passing the header If-Match: <that-etag>. That helps deal with conflicts from simultaneous updates from multiple clients.
I also had some issues with his URI design choices for his fake "map" service. Map type and scale should not be part of the path; they are really more appropriate as part of the query string. The path is referring to the same map location regardless of the map type or scale.
And finally, the Ruby examples were very distracting and completely unnecessary. I don't know Ruby, so I found it painful trying to figure out what the strange-looking syntax was really doing. To explain REST, it is not necessary to give Ruby examples... it is sufficient to explain what the URI, headers, entity-body and HTTP return status code look like. Which, fortunately, he DID do, making his own examples unnecessary. Any good developer can readily write HTTP and XML code in the language he needs to use; it isn't that difficult. So, no need to focus on one language. I'd give it 5 stars except for this annoyance, so that's why I give it 4 stars.
I definitely recommend this book despite a few of the negatives.
If you've used SOAP and/or other Web Services-related technologies/schemas/etc. etc. etc. you should have no problem following this. For beginners, however, it is definitely not the place to start. You will need to read-up a bit more on Web Services in general and some of the options and practices out there.
The repetition in the book isn't so bad. It drives home a lot of good points and covers quite a bit of in-depth information (sometimes too much, but it has come in handy when talking with other professionals/engineers).
To work with Web Services and not have at least glanced over this book would be a huge mistake. Just be careful: it may take you a while to get through. It does get a little boring from time to time.