Share via


<mtom> Element

Specifies whether a SOAP messages are encoded using the SOAP Message Transmission Optimization Mechanism (MTOM).

<microsoft.web.services3> Element
  <messaging> Element

<mtom 
  clientMode="on|off"
  maxMimeParts="64"
  requireSoapEnvelopeFirst="true|false"
  serverMode="always|never|optional"/>

Microsoft.Web.Services3.Messaging.Configuration.MtomConfigElement

Attributes and Elements

Attributes

Attribute Description

clientMode

Optional attribute. Specifies the default for whether Web services clients send SOAP messages that are MTOM encoded. Possible values are on and off.

on

Specifies that SOAP messages are MTOM encoded unless client code explicitly sets the RequireMtom property of the proxy class to false.

off

Specifies that SOAP messages are not MTOM encoded unless client code explicitly sets the RequireMtom property of the proxy class to true.

maxMimeParts

Optional attribute. Specifies the maximum number of mime parts that can be in an incoming MTOM-encoded SOAP message. The default value is 64.

requireSoapEnvelopeFirst

Optional attribute. Specifies whether the SOAP envelope must be the first MIME part in an MTOM-encoded SOAP message. Possible values are true and false. The default value is true.

serverMode

Optional attribute. Specifies whether the Web service supports the MTOM specification. Possible values are always, never, and optional. The default value is never.

always

All incoming and outgoing SOAP messages must be MTOM encoded. When a SOAP request is received that is not encoded using MTOM, an HTTP error 415: "Media unsupported" is returned to the sender.

never

All incoming SOAP messages must not be MTOM encoded. When a SOAP request is received that is encoded using MTOM, an HTTP error 415: "Media unsupported" is returned to the sender. SOAP responses and SOAP faults are not encoded using MTOM.

optional

WSE processes incoming SOAP messages whether or not they are MTOM encoded. All SOAP responses and SOAP faults match the MTOM encoding of the incoming SOAP message.

Child Elements

None

Parent Elements

Element Description

<messaging> Element

Controls the messaging settings for the Web Services Enhancements for Microsoft .NET.

Remarks

WSE 3.0 enables a client and a Web service to efficiently send large amounts of data, such as a file or image, and have that data take advantage of the WS-* specifications. For more information, see How to: Enable a Web Service to Send and Receive Large Amounts of Data and How to: Send and Receive Large Amounts of Data to and from a Web Service.

Example

The following code example requires all incoming and outgoing SOAP messages to be MTOM encoded.

<configuration>
  <configSections>
    <section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </configSections>
  <system.web>
    <webServices>
      <soapServerProtocolFactory type="Microsoft.Web.Services3.WseProtocolFactory, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    </webServices>
  </system.web>
  <microsoft.web.services3>
    <messaging>
      <mtom serverMode="always" />
    </messaging>
  </microsoft.web.services3>
</configuration>

See Also

Tasks

How to: Enable a Web Service to Send and Receive Large Amounts of Data
How to: Send and Receive Large Amounts of Data to and from a Web Service