Export (0) Print
Expand All

BinaryMessageEncodingBindingElement Class

The binding element that specifies the .NET Binary Format for XML used to encode messages.

Namespace: System.ServiceModel.Channels
Assembly: System.ServiceModel (in system.servicemodel.dll)

public sealed class BinaryMessageEncodingBindingElement : MessageEncodingBindingElement, IWsdlExportExtension, IPolicyExportExtension
public final class BinaryMessageEncodingBindingElement extends MessageEncodingBindingElement implements IWsdlExportExtension, IPolicyExportExtension
public final class BinaryMessageEncodingBindingElement extends MessageEncodingBindingElement implements IWsdlExportExtension, IPolicyExportExtension
Not applicable.

Encoding is the process of transforming a message into a sequence of bytes. Decoding is the reverse process. Windows Communication Foundation (WCF) includes three types of encoding for SOAP messages: Text, Binary and Message Transmission Optimization Mechanism (MTOM).

The BinaryMessageEncodingBindingElement is the binding element that that specified the .NET Binary Format for XML should be used for encoding messages, and has options to specify the character encoding and the SOAP and WS-Addressing version to be used. Binary encoding is most efficient but least interoperable of the encoding options.

For information about the binding element that specifies messages are encoded using a textual representation of XML, see TextMessageEncodingBindingElement.

For information about the binding element that specifies messages are encoded using the MTOM message encoding, see MtomMessageEncodingBindingElement.

To implement a custom message encoder, use the MessageEncodingBindingElement class.

BinaryMessageEncodingBindingElement be = new BinaryMessageEncodingBindingElement();
be.MaxReadPoolSize = 16;
be.MaxSessionSize = 2048;
be.MaxWritePoolSize = 16;
be.MessageVersion = MessageVersion.Default;
XmlDictionaryReaderQuotas quotas = be.ReaderQuotas;

CustomBinding binding = new CustomBinding();
BindingParameterCollection bpCol = new BindingParameterCollection();
BindingContext context = new BindingContext(binding, bpCol);
be.BuildChannelFactory<IDuplexChannel>(context);

CustomBinding binding2 = new CustomBinding();
BindingParameterCollection bpCol2 = new BindingParameterCollection();
BindingContext context2 = new BindingContext(binding2, bpCol2);
be.BuildChannelListener<IDuplexChannel>(context2);

be.CanBuildChannelListener<IDuplexChannel>(context2);
BindingElement bindingElement = be.Clone();
MessageEncoderFactory mef = be.CreateMessageEncoderFactory();
MessageVersion mv = be.GetProperty<MessageVersion>(context);

System.Object
   System.ServiceModel.Channels.BindingElement
     System.ServiceModel.Channels.MessageEncodingBindingElement
      System.ServiceModel.Channels.BinaryMessageEncodingBindingElement

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft