In the previous section, we looked at how to manage HTTP requests and responses using controllers. In this section, we will look at how to manage complex objects in our requests and responses. This section is more focused on the M part of the MVC pattern. First of all, let's distinguish between three different types of model that are usually present in web services:
- The Domain model describes the entities and the resources in our web services. It often reflects the schema of our data source, and it is very close to the lower level and the business logic of the application.
- The Request model is the representation of the model of the request. Each action method in our controller usually has its own Request model. As we will see later in this chapter, this is also the model that's associated with the validation of the request.
- The Response model is...