Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
REST in Practice
Foreword
Preface
Should I Read This Book?
Should I Skip This Book?
Resources
What Did You Think About the Book?
Errata
Conventions Used in This Book
Using Code Examples
How to Contact Us
Safari® Books Online
Acknowledgments
1. The Web As a Platform for Building Distributed Systems
Architecture of the Web
Thinking in Resources
Resources and Identifiers
Resource Representations
Representation Formats and URIs
The Art of Communication
From the Web Architecture to the REST Architectural Style
Hypermedia
REST and the Rest of This Book
The Web As an Application Platform
Technology Support
Scalability and Performance
Loose Coupling
Business Processes
Consistency and Uniformity
Simplicity, Architectural Pervasiveness, and Reach
Web Friendliness and the Richardson Maturity Model
Level Zero Services
Level One Services
Level Two Services
Level Three Services
GET on Board
2. Introducing Restbucks: How to GET a Coffee, Web Style
Restbucks: A Little Coffee Shop with Global Ambitions
Actors and Conversations
Boundaries
The Menu
Sample Interactions
Customer–Barista
Customer–Cashier–Barista
Toolbox
Restbucks Formats
Modeling Protocols and State Transitions
Here Comes the Web
3. Basic Web Integration
Lose Weight, Feel Great!
A Simple Coffee Ordering System
Choosing Integration Points for a Service
A Simple Service Architecture
URI Templates
Intuitive URIs
From Intuitive URIs to URI Templates
Using URI Templates
URI Tunneling
Is URI Tunneling a Good Idea?
POX: Plain Old XML over HTTP
Using XML and HTTP for Remote Procedure Calls
POX Away!
Server-side POX implementation in .NET
Server-side POX in Java
Client-Side POX Implementation
Using the .NET WebClient to invoke the ordering service
Using the Apache Commons HttpClient in Java
XML-RPC
What About When Things Go Wrong?
We Are Just Getting Started
4. CRUD Web Services
Modeling Orders As Resources
Building CRUD Services
Creating a Resource with POST
Implementing create with POST
Reading Resource State with GET
Implementing read with GET
Updating a Resource with PUT
Implementing update with PUT
Removing a Resource with DELETE
Safety and Idempotency
Aligning Resource State
Consuming CRUD Services
A Java-Based Consumer
A .NET Consumer
Consuming Services Automatically with WADL
CRUD Is Good, but It’s Not Great
5. Hypermedia Services
The Hypermedia Tenet
Hypermedia As the Engine of Application State
Loose Coupling
Hypermedia Formats
Hypermedia Dead Ends
URI Templates and Coupling
Selecting a Hypermedia Format
Standard hypermedia formats
Domain-specific hypermedia formats
Processing Hypermedia Formats
Media types
A media type for Restbucks
Why application/xml doesn’t help
Media type design and formats
Contracts
Contracts Begin with Media Types
Extending Contracts with Protocols
HTTP Idioms
Using Contracts at Runtime
Hypermedia Protocols
The Restbucks Domain Application Protocol
Advertising Protocols with Hypermedia
Dynamically Extending the Application Protocol
Data Modeling Versus Protocol Hypermedia
Implementing a Hypermedia Service
Building the Ordering Service in Java
Service Architecture
Java Implementation
Resources
Representations
Workflow activities
Consumer-Side Architecture
Java Consumer Implementation
Building the Ordering Service in .NET
The Restbucks .NET Hypermedia Framework
An External DSL for Hypermedia Interactions
Implementation Considerations for .NET
Resource creation
Main service logic
Payment
Delivery
Ready, Set, Action
6. Scaling Out
GET Back to Basics
Caching
Benefits of Caching
Caching and the Statelessness Constraint
Reasons for Not Caching
Types of Caches
Making Content Cacheable
Response Headers Used for Caching
Using Caching Directives in Responses
Implementing Caching in .NET
Consistency
Using Validation
Using Expiration
Using Invalidation
Extending Freshness
Cache Channels
Stay Fresh
7. The Atom Syndication Format
The Format
Common Uses for Atom
Using Atom for Event-Driven Systems
The Problem
Reference Data
Event-Driven Updates
The Anatomy of an Event
Solution Overview
Link Relations
Polling for Recent Events
Navigating the Archive
Caching Feeds
Implementation Considerations
Building an Atom Service in Java
Server-Side Architecture
Managing Feeds
Java Implementation
Using Jersey for HTTP connectivity
Generating feeds with ROME
Java Consumer Implementation
Building an Atom Service in .NET
Writing Feeds to Files
Tasks
Building Feeds
Handling Requests
Writing the response
Implementing Conditional GETs
Wiring It Up
Atom Everywhere?
After the Event
8. Atom Publishing Protocol
Atom Publishing Protocol
Overview
When to Use AtomPub
Anatomy of AtomPub
Collections
Members
Category and service documents
AtomPub Extensions to Atom
app:edited
app:control and app:draft
edit and edit-media link relation values
type parameters
Concurrency Control
Implementing Order Fulfillment Using AtomPub
Overview
Adding an Order to the Fulfillment Pipeline
Beginning Fulfillment
Failed reservation
Try again
Where are we?
Completing the Protocol
Exceptions
Summary
Implementing More Complex Protocols
Implementing AtomPub in .NET
Implementing AtomPub Collections and Members
Using Collections and Members for Order Fulfillment
Testing WCF REST Services
WCF Service Implementation
A Versatile Protocol
9. Web Security
HTTP Security Essentials
HTTP Authentication and Authorization
Transport-Level Confidentiality and Integrity
Network and Performance Considerations
Identity and the OpenID Protocol
Protocol Flow
OpenID in Java
An OpenID-enabled Java consumer
Restbucks Java ordering service
Java OpenID provider
Practical Considerations for OpenID
The OAuth Protocol
The Next Best Thing to Free Coffee?
Protocol Example
Implementing OAuth in Java
Coffee voucher service
Restbucks payment service
Restbucks customer
Practical Considerations for OAuth
Service Hacks and Defenses
Denial of Service
Keep Secrets Secret
Act Defensively
Less Is Best
Defend in Depth
Final Thoughts
10. Semantics
Syntax Versus Semantics
Structure and Representation of Information
Data, Information, Knowledge
Structure
Interpretation
Shared Understanding
Semantics
The Semantic Web
RDF
OWL
The Restbucks ontology
SPARQL
RDFa
Microformats
Linked Data and the Web
Guidance
11. The Web and WS-*
Are Web Services Evil?
SOAP: The Whole Truth
The SOAP Processing Model
Make Love, Not War
Envelope
Headers
Body
Intermediaries
Faults
WSDL: Just Another Object IDL
Two Wrongs Don’t Make a Right
Secure, Reliable, Transacted
Security
End-to-end model
Securing long-lived conversations
Issuing security tokens
Federating identities
Web services security: Sophisticated and robust, or complex and opaque?
Web Security
Federated authentication on the Web
Reliable Messaging
Reliability on the Web
Transactions
Web Transactions
Un-transactions
Respecting boundaries
A Requiem for Web Services?
12. Building the Case for the Web
No More Silver Bullets
Building and Running Web-Based Services
No Architecture Without Measurement
Selling the Web
Cost
Mitigate Risk and Release Value, Early and Often
Go Forth and Build
Index
About the Authors
Colophon
Copyright
← Prev
Back
Next →
← Prev
Back
Next →