Chapter 7. Web Services and Java Application Servers

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.

Apache Geronimo
This is an open source project.
Apache TomEE
This is essentially the Tomcat7 web server with OpenEJB extensions. This chapter includes a code example of a SOAP-based service deployed as a @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.
IBM WebSphere
This is a JAS with various extensions. There is a free version for developers.
JBoss
This JAS has been a community-based project and a JAS innovator from the start. It is currently under Red Hat.
GlassFish
This JAS is part of the community-based GlassFish Metro project, which includes the Metro implementation of JAX-WS. GlassFish is the reference implementation. This chapter includes a pair of examples that involve GlassFish, including a SOAP-based service deployed as a @Stateless Session EJB and using JPA to persist data in a backend Apache Derby database.
Oracle WebLogic
This JAS originated as BEA WebLogic, another pioneering innovator. There is a free version for developers available, as well as more information about this JAS (which is also known as Fusion).

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.