This chapter contains the following recipes:
We already know that BPEL presents the orchestration technology in the service-oriented architecture (SOA). We have already learned quite a few functionalities of BPEL, but now it's time to learn more about the fundamental building blocks that are consumed by the BPEL processes. We are talking about the web services.
In this chapter, we will focus on the lifecycle of web services through the JAX-WS specification. Throughout the recipes, we will learn the bottom-up approach of developing a web service. Usually, we can find a piece of code suitable for exposure as a web service. Through the bottom-up approach, we achieve this goal.
We can also use the top-down approach for web service development, where the starting point of the development is a WSDL document. From the web service definition, we continue the implementation of the web service methods. This approach is preferred in scenarios where we need to implement a web service from the start and no code exists.
The JAX-WS web services conform to the JSR 224 specification, which in combination with the JSR 181 specification, defines a set of annotations with which we can decorate the Java code and convert it to the web service. The mentioned specifications are a part of the Java Standard Edition, Version 6.
Remember that web services can be seen as building blocks of larger applications. One of the main advantages of web services is their reusability in various business processes which saves time and money. We will explore several aspects of web services development from design, annotation, and different configuration possibilities. We will also discuss publishing and testing web services.
Throughout this chapter, we will work on a sample of a very simplified book library. The sample consists of two data classes: BookRecord
and Member
. The BookRecord
class holds information about books and what books are reserved and borrowed. The Member
class holds the information about the members of the library. The Main
class is the BookLibrary
class, which consists of the business logic of the library with operations such as adding member, add book, and reserve a book.