This chapter examines how web services can be deployed using a JAS, the software centerpiece of enterprise Java. The current version of enterprise Java is Java EE 6, which includes EJB 3.x. Yet if web services, REST-style and SOAP-based alike, can be published straightforwardly using the production-grade web servers such as Tomcat and Jetty, why bother with a JAS at all? The chapter also delves into the reasons why a JAS might be preferred over a standalone web server such as Tomcat or Jetty. To begin, an overview of available JASes might be useful.
@Stateless
Session EJB and using JPA to
persist data in an HSQLDB database. The service is deployed under TomEE as a standard WAR file—indeed, as a WAR file that requires no web.xml document.
@Stateless
Session EJB and using JPA to
persist data in a backend Apache Derby database.
The complexity of a JAS results from its combining, into a single software application, a variety of APIs and their implementations. The following subsections describe the different architectural pieces that together make up a JAS. Even this overview of a JAS may seem overwhelming because there are so many details to cover. It is worth keeping in mind that a JAS is a very powerful, but likewise complicated, software system.