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.
To create a JAX-RS application we need to:
- Create an EJB to support the functionality of the web service
- Create a web service EJB annotated with the @Path annotation
The use of annotations makes both of these ...