Containers Demo  Locate

Overview  Locate

This demo shows how to use built-in containers on the client and server side.

By default, SESJ supports containers that implement some of the following interfaces:

java.util.List
java.util.Set
java.util.Map

There are predefined methods on the client and the server side that convert containers from Java representation to SOAP and vice versa. The only problem is that container implementation on the sending side might not be the same as on the receiving side.

The same implementation should be followed for the following built-in containers (at least when communicating Java to Java):

java.util.ArrayList
java.util.LinkedList
java.util.Vector
java.util.HashSet
java.util.TreeSet
java.util.HashMap
java.util.TreeMap
java.util.Hashtable

When only the interface is recognized, the default implementation is used:

java.util.List -> java.util.ArrayList
java.util.Set -> java.util.HashSet
java.util.SortedSet -> java.util.TreeSet
java.util.Map -> java.util.HashMap
java.util.SortedMap -> java.util.TreeMap

The Demo client takes each of the supported containers and tries to echo it. The Service takes the received container, finds out its implementation class and lets the client know what has been received.

Finally, java.util.TreeSet and java.util.HashSet implementations are run to show possible incompatibility between two implementations. It outlines the different orderings while using its own Comparators, and the differences are shown while iterating the members of the Sets.

Demo Package Description  Locate

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

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

Server source code

src/demo/advanced/containers/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 ContainersServer (it starts SESJ and publishes ContainersService class).

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

    You can look at ContainersService WSDL on 'http://localhost:6060/advanced/containers/ContainersService/wsdl' from browser.

  4. Make the client classes.

    Windows: run.bat make_client
    Linux:   ./run.sh make_client
    
  5. Run ContainersClient (it calls ContainersService).

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

    If you wish to follow the progress of the invocation with SoapSpy, perform the following:

    1. Run server_java60/bin/soapspy.bat or soapspy.sh. This will bring up the SoapSpy GUI.

    2. Start spying by selecting Start Spying from the Spy menu or by clicking the spy icon in the main pane.

    3. Run the client using the run spy_client command instead of run_client.

Persistent Deployment  Locate

To run using Persistent Deployment:

  1. Be sure that you've started SESJ.

  2. Compile ContainersService.

    Windows: run.bat make_service
    Linux:   ./run.sh make_service
    
  3. Deploy ContainersService 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 ContainersClient (it calls ContainersService).

    Windows: ./run.bat run_client
    Linux:   ./run.sh run_client
    
  6. Undeploy ContainersService from the SESJ.

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