In the previous article, we laid the foundation of our implementation by developing the resource layer, including automated unit tests that carefully exercised the functionality of our Order resource class. In this article, we will continue the implementation of our web application by creating the service layer that will interface with our order management web service. Along the way, we will explore the Dependency Injection (DI) and Hypertext Transfer Protocol (HTTP) functionality of Angular.
Implementing the Service Layer
The ultimate purpose of our service layer is to abstract the web service that manages our orders and to allow other components (namely the UI layer) to obtain Order resources and commit changes to these Orderresource objects. In order to accomplish this, we must understand the Representational State Transfer (REST) endpoints that the web service provides and how to interface with these endpoints. As designed in Creating a REST Web Service With Java and Spring (Part 1), our order management web service has the following endpoints: