This sample demonstrates the capabilities of Message Transmission Optimization Mechanism (MTOM). An MTOM Web Service accepts a fileName and a DataHandler. The DataHandler contains the binary content which is eventually saved to a temporary location in a given fileName.
Building and Running the Sample
To build the samples you need Apache Ant build tool.
Note:
Apache Ant 1.6.2 or higher is needed.
The steps are as follows:
1. Install and run the WSO2 Application Server. Refer to the Installation Guide for instructions.
2. In a command prompt, switch to the MTOM directory.
For example, in Windows, cd <AS_HOME>\samples\MTOM
3. From there, type ant .
The generated service (MTOMSample.aar) gets copied to <AS_HOME>/repository/deployment/server/axis2services automatically. Start the Application Server using <AS_HOME>/bin/wso2server.sh (in Linux) or <AS_HOME>\bin\wso2server.bat (in Windows).
Use the script run-client.sh or run-client.bat file to invoke the client using arguments
- file : Full Path of the file that needs to be sent to the service (mandatory)
- fileName : Name of file to be created at the server side (optional)
- e : Endpoint URL of the service (optional)
- help : For Help
For example, ./run-client.sh -file /tmp/wwe.jpg -fileName wresting.jpg
Note:
Sometimes, it is necessary to clean the services repository before you generate and deploy the service and run the client. In order to do that, delete services created from previous samples.