EJB Endpoints
An EJB endpoint is a stateless session bean that serves as a web service. Basically, the endpoint exposes a stateless session bean through a new component interface, called the endpoint interface; remote clients use SOAP 1.1 to access the methods defined in this interface. Because an EJB endpoint is simply a SOAP-accessible stateless session bean, it has the same advantages as other EJBs. An EJB endpoint runs in the EJB container that automatically manages transactions and security and provides access to other EJBs and resources via the JNDI ENC.
To illustrate how an EJB endpoint is developed, we’ll create a new version of the TravelAgent EJB. The revised TravelAgent will use the same logic as the TravelAgent EJB developed in Chapter 11 and the ReservationProcessor developed in Chapter 12, but it will be deployed as a stateless session bean with an endpoint interface. The TravelAgent endpoint is based on the WSDL document shown earlier in this chapter.
The WSDL Document
Every EJB endpoint must have a WSDL document
that describes the web service. The
<portType>
declared by the WSDL document
must be aligned with the endpoint interface of the web service. In
other words, the mapping between the WSDL
<portType>
and the endpoint interface must
be correct according to the JAX-RPC specification. One way to
accomplish this is to create the WSDL document first, and then use it
to generate the endpoint interface:
<?xml version="1.0"?> <definitions name="TravelAgent" xmlns="http://schemas.xmlsoap.org/wsdl/" ...
Get Enterprise JavaBeans, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.