Chapter 16. Refactoring to Services

In the previous chapter, we created a basic XML-RPC service. All it could do was return a movie object. However, even with just this simple example behind you, you should have a solid understanding of what services are for, what considerations should go into their design, and how to build a simple one. In this chapter, we’ll take all of that foundation and use it to connect three applications together: two back-end services that talk to each other and our integration test framework, which in this chapter will simulate a front-end talking to those services.

Figure 16-1 shows what our architecture will look like by the end of this chapter. First, we’ll build a simple orders service, which allows us to add new products to the product database and place orders. Then, we’ll integrate our movies service with the new orders service. Whenever we add a showtime to the system, we’ll register that showtime as a product in the orders service so that tickets can be sold. We won’t actually create a front-end application, but we’ll simulate doing so by building new tests in our integration test framework, which tests services the way a real client would access them.

Three applications connected in a service-oriented architecture

Figure 16-1. Three applications connected in a service-oriented architecture

Our main goal is to learn how to connect systems together in an efficient and natural way. While Figure 16-1 ...

Get Enterprise Rails now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.