All docs This doc

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


This sample demonstrates how you can use content optimization mechanisms such as  Message Transmission Optimization Mechanism  (MTOM) and SOAP with Attachments ( SwA) with the ESB. 

By default ESB serializes binary data as Base64 encoded strings and sends them in the SOAP payload.  MTOM and SwA with the ESBdefine mechanisms over which files with binary content can be transmitted over SOAP web services.



For a list of prerequisites, see Prerequisites to Start the ESB Samples.


This configuration file  synapse_sample_51.xml is available in the <ESB_HOME>/repository/samples directory.

  • <property name="enableMTOM" value="true" scope="axis2"/>
    When this is enabled, all outgoing messages will be serialized and sent as MTOM optimized MIME messages.You can override this configuration per service in the services.xmlconfiguration file.
  • <property name="enableSwA" value="true" scope="axis2"/>
    When this is enabled, incoming SwA messages are automatically identified by axis2.

    The above properties can also be defined in <ESB_HOME>/repository/conf/axis2/axis2.xml file.


To build the sample

  1. Start the ESB with the sample 51 configuration. For instructions on starting a sample ESB configuration, see Starting the ESB with a sample configuration.

    The operation log keeps running until the server starts, which usually takes several seconds. Wait until the server has fully booted up and displays a message similar to "WSO2 Carbon started in n seconds."

  2. Start the Axis2 server. For instructions on starting the Axis2 server, see Starting the Axis2 server.

  3. Deploy the back-end service MTOMSwASampleService. For instructions on deploying sample back-end services, see Deploying sample back-end services.