Although Restbucks is contrived to provide a simple problem domain, we will be using real web technologies. We will choose the appropriate URIs for identifying resources, identify the formats that meet business and technical requirements, and apply the necessary patterns for modeling and implementing interactions. With that in mind, it’s time to see some examples of how web technologies might be used to model interactions.
We discussed formats for resource representations in general
terms in Chapter 1,
but here we’ll introduce formats that Restbucks uses in its business.
All Restbucks resources are represented by XML documents defined in
and identified on the Web as the media types
application/vnd.restbucks+xml for standard
XML processing and Restbucks-specific processing,
We’ve chosen XML-based formats deliberately for this book since they’re easily understood and readable by humans. However, we shouldn’t see XML as the only option. As we discussed in Chapter 1, real web services use myriad other formats, depending on the application.
Example 2-1 shows an order represented in XML, with the different specialties and options drawn from the Restbucks menu. We’ve chosen element names for the XML representations that are easy for humans to understand, even though that is not strictly necessary for machine-to-machine communication. However, we believe there’s value in making representations—like ...