This topic has not yet been rated - Rate this topic

WebMessageEncodingElement Class

Represents the configuration element that specifies the character encoding used for non-SOAP messages. This class cannot be inherited.

Namespace:  System.ServiceModel.Configuration
Assembly:  System.ServiceModel.Web (in System.ServiceModel.Web.dll)
public final class WebMessageEncodingElement extends BindingElementExtensionElement

Encoding is the process of transforming a set of Unicode characters into a sequence of bytes. The types of encoding for non-SOAP messages are text, JSON and raw.

The WebMessageEncodingElement represents the WebMessageEncodingBindingElement in configuration. The WebMessageEncodingBindingElement provides the extensibility point for plugging in a composite encoder that can be used to override how incoming message content-types map to the various inner encoders (text/JSON/raw binary) provided by Windows Communication Foundation (WCF). The composite message encoder does not support SOAP or WS-Addressing.

using System;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.ServiceModel.Configuration;

class Program
{
  static void Main(string[] args)
  {
      WebMessageEncodingElement webMEE = new WebMessageEncodingElement();
      Console.WriteLine("The BE type is: {0}", webMEE.BindingElementType);

      int maxReadPoolSize = webMEE.MaxReadPoolSize;
      Console.WriteLine("The MaxReadPoolSize is: {0}", maxReadPoolSize);
      maxReadPoolSize = 128;
      Console.WriteLine("The MaxReadPoolSize has been changed to: {0}", maxReadPoolSize);

      int maxWritePoolSize = webMEE.MaxWritePoolSize;
      Console.WriteLine("The MaxWritePoolSize is: {0}", maxWritePoolSize);
      maxWritePoolSize = 48;
      Console.WriteLine("The MaxWritePoolSize has been changed to: {0}", maxWritePoolSize);

      Encoding webMessageEncoding = webMEE.WriteEncoding;
      Console.WriteLine("The write encoding is: {0}", webMessageEncoding);
      webMessageEncoding = UnicodeEncoding.Unicode;
      Console.WriteLine("The write encoding has been changed to: {0}", webMessageEncoding);

      XmlDictionaryReaderQuotasElement webMessageReaderQuotasElement = webMEE.ReaderQuotas;
      Console.WriteLine("The max depth of the reader Quotas is: {0}", webMessageReaderQuotasElement.MaxDepth);

      Console.WriteLine("Press <ENTER> to terminate the program.");
      Console.ReadLine();
        }
    }
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 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.