SOAP with Attachments Demo  Locate

Overview  Locate

The demo shows how to write web services to work with very large amounts of data. This demo uses either MIME multipart/related encoding or DIME which can handle large amounts of data efficiently.

Applications that have to process very large amounts of data tend to suffer from performance problems. You can partially avoid this by using concurrent reading and writing of input and output. In SESJ, you can do this using the org.idoox.wasp.types.MessageAttachment class. This class is supported directly by SESJ.

This demo is a simple service which receives and sends a large amount of data and compresses/decompresses it using a zip algorithm. For this purpose a new thread is created and connected to PipedInputStream and PipedOutputStream. While concurrent threads manage the data processing, the main service thread exits from the service method and returns control to SESJ.

There are three service endpoints created, they are using different attachment encapsulation. The "demo/advanced/AttachmentService" endpoint uses the default attachment encapsulation (MIME or DIME) chosen during SESJ installation. The "demo/advanced/MIMEService" and "demo/advanced/DIMEService" endpoints use explicitly chosen MIME/DIME encapsulation.

To start, the client creates a chunk of data approx. 10MB in size and then sends it to the server where is it compressed. When data is returned, it is then decompressed in the same manner. The results are saved in the following files:

demoDataDefault.pack
demoDataMIME.pack
demoDataDIME.pack      - compressed data sent to server
demoDataDefault.unpack
demoDataMIME.unpack
demoDataDIME.unpack    - decompressed data received from server
[Note]Note

This demo might not work correctly on some application servers due to their inability to communicate using chunked HTTP messages (sending the message by parts).

If you want to run this demo over JMS transport, increase the memory limits for JVM on both the server and the client side to at least 256MB (-Xmx256m)

Demo Package Description  Locate

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

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

Server source code

src/demo/advanced/attachments/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 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 AttachmentsServer (it starts SESJ and publishes the AttachmentsService class).

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

    You can look at service WSDL descriptions on 'http://localhost:6060/demo/advanced/AttachmentsService/wsdl', 'http://localhost:6060/demo/advanced/MIMEService/wsdl' and 'http://localhost:6060/demo/advanced/DIMEService/wsdl' from your browser.

  4. Make the client classes.

    Windows: run.bat make_client
    Linux:   ./run.sh make_client
    
  5. Run AttachmentsClient (it calls AttachmentsService).

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

Persistent Deployment  Locate

  1. Be sure that you've started SESJ.

  2. Compile AttachmentsService.

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

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

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