94
Designing a Service's Interaction Layer
A Web service such as this can be designed using a service endpoint that
receives the client's request and then delegates the request directly to the service's
appropriate logic in the processing layer. The service's processing layer processes
the request and, when the processing completes, the service endpoint returns the
response to the client. (See Figure 3.6.)
Code Example 3.15 shows the weather service interface performing some
basic parameter validation checks in the interaction layer. The interface also gets
required information and passes that information to the client in a synchronous
manner:
public class WeatherServiceImpl implements
WeatherService, ServiceLifecycle {
public void init(Object context) throws JAXRPCException {....}
public String getWeather(String city)
throws CityNotFoundException {
/** Validate parameters **/
if(!validCity(city))
throw new CityNotFoundException(....);
/** Get weather info form processing layer and **/
/ **return results **/
return (getWeatherInfoFromDataSource(city));
}
public void destroy() {....}
}
Code Example 3.15
Performing a Synchronous Client Interaction
Now let's examine an asynchronous interaction between a client and a ser
vice. When making a request for this type of service, the client cannot afford to
wait for the response because of the significant time it takes for the service to
process the request completely. Instead, the client may want to continue with
some other processing. Later, when it receives the response, the client resumes
whatever processing initiated the service request. Typically in these types of ser
footer
Our web partners:
Inexpensive
Web Hosting
Java Web Hosting
personal webspace
webspace php
linux webhost
html web templates
DreamweaverQuality Web Templates
PSD Web Templates
cheap webhost
j2ee web Hosting
buy webspace
ftp webspace
adult webspace
frontpage WebHosting
webspace hosting
cheap webhost
Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved
webhosting