Implementing Services

Every service ultimately needs to perform some processing to order to respond to client requests. Such server-side processing occurs in the service implementation, which is based on the well-known servlet architecture.

A service implementation must extend RemoteServiceServlet and must implement the associated service interface. Note that the service implementation does not implement the asynchronous version of the service interface.

Every service implementation is ultimately a servlet, but rather than extending HttpServlet, it extends RemoteServiceServlet instead. RemoteServiceServlet automatically handles serialization and invoking the intended method in your service implementation.

Testing Services During Development

To automatically load your service implementation, use the <servlet> tag within your module XML. The GWT development shell includes an embedded version of Tomcat which acts as a development-time servlet container for testing.

Deploying Services Into Production

In production, you can use any servlet container that is appropriate for your application. You need only to ensure that the client code is configured to invoke the service using the URL to which your servlet is mapped by the web.xml configuration. See ServiceDefTarget for more information.