EJB 3.0 and WebServices

by Krishna Srinivasan

JSR-181, which is the "Web Services Metadata for the Java Platform", simplifies the development of Web-Services in the Java/J2EE environment. Ordinary Java classes can be turned immediately into Web-Services by applying Web-Services specific meta-data (in the form of annotations) to the code. No need for the application developers to use the SOAP API's for parsing, validation, construction, sending and receiving messages as the container will implicitly do that. Also, generation of WSDL (Web Services Description Language) files are also taken care by the container so there is only minimal burden left on the developers to create a Web-Service using the Meta-data API.

The entire API for developing Web-Services is available in javax.jws and javax.jws.soap packages. Among the several types of enterprise beans, stateless session beans are an excellent choice to be represented as a Web-Service component, since they are stateless in nature. Remember that all the interactions that take place between Web-Services applications are stateless (i.e. no history of the conversations are maintained) so stateless enterprise beans could represent an ideal solution for developing Web-Service components. Shunmuga Raja explain's in detail here.

EJB 3.0 and WebServices

Integrating Struts With Spring