Java Reference
In-Depth Information
there are also ways to deal with this limitation that are provided by the general framework.
For example, you can use handlers to modify outbound messages if necessary.
Service Endpoints
A web service endpoint is a server-side component that receives SOAP messages, does some
processing, and returns a SOAP message result. Because they execute on an application serv-
er, there are two types of service endpoint components you can create:
A servlet
A servlet
Note that while documentation refers to this type of web service implementation as a “ser-
vlet” implementation, this is actually an annotated POJO (Plain Old Java Object) class,
and nota class that extends the javax.servlet.http.HttpServlet class. This kind of
service implementation is packaged in a WAR and deployed just as you would a servlet,
but the actual servlet implementation will be provided by JAX-WS, which handles the
HTTP requests and responses, translates the SOAP messages, and is multithreaded. In
some web containers, you need to provide a regular servlet mapping in web.xmlas you
would for a regular servlet. In Glassfish, you can just package the class in a WAR and de-
ploy it; it will provide the mapping for you at deploy time.
A stateless session bean
This is the only kind of EJB that can be implemented as a web service. As with the servlet
version, you consume your EJB web service endpoint via a WSDL interface, HTTP, and
SOAP messages, all of which is handled by JAX-WS.
So you do not need an EJB container to provide a web service if you go the regular “servlet”
route.
Packages and Classes
The core JAX-WS APIs are in the javax.xml.ws package and its subpackages, which include
several packages related to HTTP, SOAP, and using handlers.
JAX-WS can be found in two packages, the primary package being javax.jws . This package
is small, but mighty, consisting of no classes, no interfaces, six annotations, and a single enum.
The annotations here are the primary means of creating portable web services:
package com.soacookbook;
import javax.jws.WebService;
import javax.jws.WebMethod;
Search WWH ::




Custom Search