Stateful Demo  Locate

Overview  Locate

This demo shows a stateful service and session management in SESJ.

There are two services:

  • demo.advanced.stateful.server.PerClientService: this service is published with a per-client instantiation flag. Each instance of this service thus corresponds to one client.

  • demo.advanced.stateful.server.SingletonService: this service is published as a shared instance (by default in SESJ) so there is only one instance for all clients. The service manages sessions by hand and shows how to continue with the session to the next service (demo.advanced.stateful.server.PerClientService).

StatefulClient is able to register a new client to PerClientService and prints this client ID. Each such created ID corresponds to one instance of PerClientService. When the client is called with a given ID the SingletonService uses this ID to talk to the right PerClientService instance.

Demo Package Description  Locate

In addition to the files described in Files and Directories, this demo contains:

File or directoryDescription
src/demo/advanced/stateful/server/

Server source code

src/demo/advanced/stateful/client/

Client source code

Building and Running Demos  Locate

You can run the demo using the "run.sh" (for UNIX) or "run.bat" (for Windows) scripts. Running the script without arguments prints out a help message on screen.

The demo can be run in two different ways:

Runtime Publishing  Locate

To use Runtime Publishing, follow these steps:

  1. Be sure that you have not started SESJ.

  2. Compile the server classes.

                        Windows: run.bat make_server
                        Linux:   ./run.sh make_server
                        
  3. Run StatefulServer (it starts SESJ and publishes SingletonService and PerClientService classes).

                        Windows: run.bat run_server
                        Linux:   ./run.sh run_server (use a new terminal)
                        

    You can look at service WSDLs on 'http://localhost:6060/demo/advanced/stateful/PerClientService/wsdl' and 'http://localhost:6060/demo/advanced/stateful/SingletonService/wsdl' from your browser.

  4. Make the client classes.

                        Windows: run.bat make_client
                        Linux:   ./run.sh make_client
                        
  5. Run StatefulClient (it calls SingletonService and PerClientService).

                        Windows: run.bat run_client
                        Linux:   ./run.sh run_client
                        

    You can view the SOAP messages with the SOAPSpy tool. This is in the "server_java60/bin" directory. When running SOAPSpy, use "spy_client" instead of "run_client" as the target.

    You can run the demo interactively. In such a case, use "run_client_int" instead of "run_client" as the target. Similarly, use "spy_client_int" to combine both options.

Persistent Deployment  Locate

To run using Persistent Deployment:

  1. Be sure that you have started SESJ.

  2. Compile SingletonService and PerClientService.

                        Windows: run.bat make_service
                        Linux:   ./run.sh make_service
                        
  3. Deploy SingletonService and PerClientService on the SESJ.

                        Windows: run.bat deploy_service
                        Linux:   ./run.sh deploy_service
                        
  4. Make the client classes.

                        Windows: ./run.bat make_client
                        Linux:   ./run.sh make_client
                        
  5. Run StatefulClient (it calls SingletonService and PerClientService).

                        Windows: ./run.bat run_client
                        Linux:   ./run.sh run_client
                        
  6. Undeploy SingletonService and PerClientService from the SESJ.

                        Windows: run.bat undeploy_service
                        Linux:   ./run.sh undeploy_service