MTOM Capabilities
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 that is eventually saved to a temporary location in a given fileName.
Building the sample
The MTOM sample is located in <PRODUCT_HOME>\Samples\MTOM
directory.
For more information, see Building Axis2 Samples.
The generated service (MTOMSample.aar
) gets copied to the <PRODUCT_HOME>/repository/deployment/server/axis2services
directory automatically.
Running the sample
Start the WSO2 Application Server by executing one of the following commands, where
<PRODUCT_HOME>
is the directory where you installed the product distribution:OS Command On Windows <PRODUCT_HOME>\bin\wso2server.bat --run
On Linux/Solaris sh <PRODUCT_HOME>/bin/wso2server.sh
Execute one of the following commands with arguments to run the client:
OS Command On Windows run-client.bat
On Linux/Solaris sh run-client.sh
- 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
Sometimes, it is necessary to clean the services repository before you generate and deploy the service and run the client. To clean the services repository, you can delete services created from previous samples.