The demo shows how to write Web services using MTOM technology to work with both small and very large amounts of data. In addition, this demo uses XML MIME schema constructs enabling correct passing of content type even if binary data are serialized as base64Binary content.
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. But if you want to use MTOM technology you have to use the org.idoox.wasp.types.MtomMessageAttachment class instead.
This demo contains a simple service which receives both a small and a very large amount of data. The received data are processed (in this case, they are printed to the system console) and processed data Adler 32 checksum is returned back to client.
This demo uses the "demo/advanced/MtomService" service endpoint.
To start, the client creates a chunk of both small and big amount of data. Both chunks of data are then sent to service. The service processes them and returns an Adler 32 checksum of processed bytes.
![]() | 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). |
In addition to the files described in Files and Directories, this demo contains:
File or directory | Description |
---|---|
src/demo/advanced/mtom/server/ | Server source code |
src/demo/advanced/mtom/client/ | Client source code |
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:
To use Runtime Publishing, follow these steps:
Be sure that you have not started SESJ. Shut the server down if it has been started.
Compile the server classes.
Windows: run.bat make_server Linux: ./run.sh make_server
Run MtomServer (it starts SESJ and publishes the MtomService 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/MtomService/wsdl from your browser.
Make the client classes.
Windows: run.bat make_client Linux: ./run.sh make_client
Run MtomClient (it calls MtomService).
Windows: run.bat run_client Linux: ./run.sh run_client
Start the SESJ.
Compile MtomService.
Windows: run.bat make_service Linux: ./run.sh make_service
Deploy MtomService on the SESJ.
Windows: run.bat deploy_service Linux: ./run.sh deploy_service
Make the client classes.
Windows: run.bat make_client Linux: ./run.sh make_client
Run MtomClient (it calls MtomService).
Windows: run.bat run_client Linux: ./run.sh run_client
Undeploy MtomService from the SESJ.
Windows: run.bat undeploy_service Linux: ./run.sh undeploy_service