WebMessageEncodingBindingElement Class

 

Enables plain-text XML, JavaScript Object Notation (JSON) message encodings and "raw" binary content to be read and written when used in a Windows Communication Foundation (WCF) binding.

Namespace:   System.ServiceModel.Channels
Assembly:  System.ServiceModel.Web (in System.ServiceModel.Web.dll)

System.Object
  System.ServiceModel.Channels.BindingElement
    System.ServiceModel.Channels.MessageEncodingBindingElement
      System.ServiceModel.Channels.WebMessageEncodingBindingElement

public sealed class WebMessageEncodingBindingElement : MessageEncodingBindingElement, 
	IWsdlExportExtension

NameDescription
System_CAPS_pubmethodWebMessageEncodingBindingElement()

Initializes a new instance of the WebMessageEncodingBindingElement class.

System_CAPS_pubmethodWebMessageEncodingBindingElement(Encoding)

Initializes a new instance of the WebMessageEncodingBindingElement class with a specified write character encoding.

NameDescription
System_CAPS_pubpropertyContentTypeMapper

Gets or sets how the content type of an incoming message is mapped to a format.

System_CAPS_pubpropertyCrossDomainScriptAccessEnabled

Gets or sets a value that determines if cross domain script access is enabled.

System_CAPS_pubpropertyMaxReadPoolSize

Gets or sets a value that specifies the maximum number of readers that is allocated to a pool and that is available to process incoming messages without allocating new readers.

System_CAPS_pubpropertyMaxWritePoolSize

Gets or sets a value that specifies the maximum number of writers that is allocated to a pool and that is available to process outgoing messages without allocating new writers.

System_CAPS_pubpropertyMessageVersion

Gets or sets the message version that indicates that the binding element does not use SOAP or WS-Addressing.(Overrides MessageEncodingBindingElement.MessageVersion.)

System_CAPS_pubpropertyReaderQuotas

Gets constraints on the complexity of SOAP messages that can be processed by endpoints configured with this binding.

System_CAPS_pubpropertyWriteEncoding

Gets or sets the character encoding that is used to write the message text.

NameDescription
System_CAPS_pubmethodBuildChannelFactory<TChannel>(BindingContext)

Builds the channel factory stack on the client that creates a specified type of channel for a specified context.(Overrides BindingElement.BuildChannelFactory<TChannel>(BindingContext).)

System_CAPS_pubmethodBuildChannelListener<TChannel>(BindingContext)

Builds the channel listener stack on the client that accepts a specified type of channel for a specified context.(Overrides BindingElement.BuildChannelListener<TChannel>(BindingContext).)

System_CAPS_pubmethodCanBuildChannelFactory<TChannel>(BindingContext)

Returns a value that indicates whether the binding element can build a channel factory for a specific type of channel.(Inherited from BindingElement.)

System_CAPS_pubmethodCanBuildChannelListener<TChannel>(BindingContext)

Returns a value that indicates whether the current binding can build a listener for a specified type of channel and context.(Overrides BindingElement.CanBuildChannelListener<TChannel>(BindingContext).)

System_CAPS_pubmethodClone()

Creates a new WebMessageEncodingBindingElement object initialized from the current one.(Overrides BindingElement.Clone().)

System_CAPS_pubmethodCreateMessageEncoderFactory()

Creates a message encoder factory that produces message encoders that can write either JavaScript Object Notation (JSON) or XML messages.(Overrides MessageEncodingBindingElement.CreateMessageEncoderFactory().)

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetProperty<T>(BindingContext)

Returns the object of the type requested, if present, from the appropriate layer in the channel stack, or null if it is not present.(Overrides MessageEncodingBindingElement.GetProperty<T>(BindingContext).)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodIWsdlExportExtension.ExportContract(WsdlExporter, WsdlContractConversionContext)

Generates WSDL contract information from encoding policies contained in the binding element.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIWsdlExportExtension.ExportEndpoint(WsdlExporter, WsdlEndpointConversionContext)

Generates WSDL contract information from encoding policies contained in the binding element.

Encoding is the process of transforming a message into a sequence of bytes. Decoding is the reverse process. These processes require the specification of a character encoding. The WebMessageEncodingBindingElement works by delegating to a series of inner encoders to handle the plain-text XML and JSON encodings, and "raw" binary data. This delegation is done by a composite message encoder.

This binding element and its composite encoder are used to control the encoding in scenarios that do not use SOAP messaging used by the WebHttpBinding. These scenarios include "Plain Old XML" (POX), Representational State Transfer (REST), Really Simple Syndication (RSS) and Atom syndication, and Asynchronous JavaScript and XML (AJAX). The composite message encoder does not support SOAP or WS-Addressing, and so MessageVersion always returns None.

The binding element can be configured with a write character encoding at construction time using the WebMessageEncodingBindingElement(Encoding) constructor. The Encoding value specifies the behavior on write for the JSON and Textual XML cases. On read, any valid message encoding and text encoding is understood.

This constructor sets default values on the maximum number of readers and writers that are allocated to pools and that are respectively available to process incoming and outgoing messages without allocating new readers or writers. The properties MaxReadPoolSize and MaxWritePoolSize can also be used to set the maximum number of readers and writers to be allocated respectively. By default 64 readers and 16 writers are allocated.

Default complexity constraints are also set by this constructor on the XmlDictionaryReaderQuotas associated with this encoding by the ReaderQuotas property to protect against a class of denial of service (DOS) attacks that attempt to use message complexity to tie up endpoint processing resources.

The WebMessageEncodingBindingElement has a CreateMessageEncoderFactory method that creates a message encoder factory that produces JSON, XML or Raw message decoders and encoders as appropriate depending on the content type specified.

The WebMessageEncodingBindingElement also provides the methods to build the factories and listeners for the channels through which the HTTP requests flow.

The composite encoder and its associated classes and configuration components are usable in partial trust and this use does not require any special permissions.

.NET Framework
Available since 3.5

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

Return to top
Show: