Polymorphic Demo  Locate

Overview  Locate

The polymorphism demo shows how Java polymorphism is mapped to XML Schema polymorphism and vice versa. The demo consists of :

  1. service, which expects instance of Message and prints it out. see src/demo/advanced/polymorphic/server/PolymorphicService.java

  2. client which creates an instance of TextMessage and UpperTextMessage and passes them to server.

After running, you should see the following two lines on the server-side:

demo.polymorphic.TextMessage: Hello
demo.polymorphic.UpperTextMessage: HELLO

that show that the TextMessage / UpperTextMessage was correctly serialized/deserialized.

Demo Package Description  Locate

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

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

Server source code

src/demo/advanced/polymorphic/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 PolymorphicServer (it starts SESJ and publishes the PolymorphicService class).

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

    You can look at PolymorphicService WSDL on 'http://localhost:6060/demo/advanced/PolymorphicService/wsdl' from the browser.

  4. Make the client classes.

    Windows: run.bat make_client
    Linux:   ./run.sh make_client
    
  5. 5. Run PolymorphicClient (it calls PolymorphicService).

    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. Ensure sure that you've started SESJ.

  2. Compile PolymorphicService.

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

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

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