You are previewing REST in Practice.
O'Reilly logo
REST in Practice

Book Description

REST continues to gain momentum as the best method for building web services, leaving many web architects to consider whether and how to include this approach in their SOA and SOAP-dominated world. This book offers a down-to-earth explanation of REST, with techniques and examples that show you how to design and implement integration solutions using the REST architectural style.

Table of Contents

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