O'Reilly logo

EJB 3.1 Cookbook by Richard M. Reese

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Accessing an EJB from a web service (JAX-RS)

Java EE 6 supports Java API for RESTful Web Services (JAX-RS), a Representational State Transfer (RESTful) web service. This type of service does not require WDSL or XML messages. In this recipe we will create a simple RESTful application, RESTApplication, which returns a random tip of the day message.

The beauty of this application is its simplicity and ease of development. We will create two EJBs: one for the application's functionality and a second one to represent the Web Service.

Getting ready

To create a JAX-RS application we need to:

  1. Create an EJB to support the functionality of the web service
  2. Create a web service EJB annotated with the @Path annotation

    The use of annotations makes both of these ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required