Overview of MTOM
Using MTOM an application can send or receive a large amount of data. MTOM allows message-level security to be applied to the message including binary data. MTOM encodes the SOAP message and transmits the message as XML.
Following is the procedure to send large amount of data using MTOM
- Open the web service project in Visual studio 2005
2. Enable the project to use WSE by
a. In solution explorer right click the project and then click WSE Settings
b. Select the general tab
c. Select Enable this project for Web Services Enhancements and
Enable Microsoft Web Services Enhancements SOAP Protocol
Factory.
3. Specify that web service can accept SOAP messages encoded using MTOM.
a. In solution explorer right click the project and then click WSE Settings.
b. Select the Messaging tab.
c. Choose optional or always for the Server Mode.
always MTOM mode specifies that all incoming and outgoing SOAP
messages must be MTOM encoded.
optional MTOM mode specifies that whether or not all incoming and
outgoing messages can be encoded.
Define a Web service method that returns a byte array.
[WebMethod]
public byte[] GetFile(string fileName){
byte[] response; String filePath = AppDomain.CurrentDomain.BaseDirectory+ @"App_Data\" + fileName; response = File.ReadAllBytes(filePath); return response;}
4. Configure the Web server to handle the larger amount of data.
<configuration> <system.web> <httpRuntime maxMessageLength="409600" executionTimeoutInSeconds="300"/> </system.web> </configuration>
MTOM Support to web service…
You’ve been kicked (a good thing) – Trackback from DotNetKicks.com…
[…] 3. For more information MTOM Support to Web service. […]
How do we send an attachment to a webservice by using WSE3.0 with MTOM?