February 2002
Beginner
308 pages
8h 39m
English
The complete service code is shown
in Example 5-11. The code maintains a single instance
variable, called counter. For each client request,
counter is incremented.
package com.ecerami.soap;
/**
* A Sample SOAP Service
* Illustrates Session v. Application Scope
*
* When this service is deployed with Scope="Session",
* server will instantiate one instance of CounterService
* per client. CounterService will then maintain total
* number of requests per session.
*
* When this service is deployed with Scope="Application",
* server will instantiate just one instance of CounterService.
* CounterService will then maintain total number of requests
* across all sessions.
*
*/
public class CounterService {
private int counter; // Number of requests
/**
* Constructor
*/
public CounterService ( ) { counter = 0; }
/**
* Return number of requests
*/
public int getCounter ( ) { return ++counter; }
}Read now
Unlock full access