WSDualHttpBinding in WCF

The WSDualHttpBinding is almost a mirror image of the WSHttpBinding except for one aspect, which is that WSDualHttpBinding supports duplex services. A duplex service is a service that uses duplex message patterns. These patterns provide the ability for a service to communicate back to the client via a callback.
The WSDualHTTPBinding also supports communication via SOAP intermediaries. They are not a part of WCF but certainly can have a hand in dealing with WCF services and messages in areas such as routing and load balancing. This binding allows the communication through intermediaries.
With WSDualHttpBinding, reliable sessions are enabled by default. Not so with WSHttpBinding. In WSHttpBinding, reliable sessions are disabled by default and must be enabled if you want to use them.

WSDualHttpBinding Properties

The following table is a list of attributes, and their descriptions, that are available to be used with the WSDualHttpBinding.

Attribute Description
bypassProxyOnLocal Boolean value, default of False, which specifies whether or not to bypass the proxy server for local Internet resources.
clientBaseAddress A URI that specifies the base address that the client listens to for response messages from the service. The default is null.
closeTimeout A time interval value, which must be greater than zero, that specifies the amount of time for a close operation to complete. The default value is 1 minute (00:01:00).
hostnameComparisonMode Specifies the HTTP hostname comparison node used to parse URIs. Acceptable values are Exact, StrongWildCard, and WeakWildCard. The default value is StrongWildCard.
maxBufferPoolSize Specifies the maximum buffer size for a buffer pool, which stores messages processed by the binding. This is an integer value with a default of 512*1024, or 524388.
maxReceivedMessageSize Specifies the maximum size of a message, including headers. The number is specified in bytes with a default value of 65536. If a message is larger than the value specified, the sender receives a SOAP fault message and the receiver drops the message and creates an event in the trace log.
messageEncoding Defines the type of encoding used to encode the message. Acceptable values are Text (text encoding) and Mtom (Message Transmission Organization Mechanism 1.0 encoder). Default is Text.
Name A unique string value that contains the configuration name of the binding.
openTimeout A time interval value that specifies the amount of time a message has to complete. Value should be greater than zero. Default is 1 minute (00:01:00).
proxyAddress Used in conjunction with the useDefaultWebProxy attribute. This attribute is a URI that specifies the address of the HTTP proxy. If the useDefaultWebProxy attribute is set to True, this value must be null.
receiveTimeout A time interval value that specifies the amount of time a receive operation has to complete. Value should be greater than zero. Default is 1 minute (00:01:00).
sendTimeout A time interval value that specifies the amount of time a send operation has to complete. Value should be greater than zero. Default is 1 minute (00:01:00).
textEncoding Specifies the character encoding set. Acceptable values are UnicodeFffeTextEncoding,
Utf16TextEncoding, and Utf8TextEncoding. Default is Utf8TextEncoding. This value is used for emitting binding messages.
transactionFlow Boolean value, default of False, which specifies whether the binding supports flowing WS-Transactions.
useDefaultWebProxy Boolean value, default of True, which specifies whether the autoconfigured HTTP proxy should be used if one exists.

The following example illustrates some of the properties being configured in a configuration file:

<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name = “wsDualhttpbind” clientbaseaddress = “http://localhost:8080/client” transactionflow = “false” closeTimeout = “00:00:30” receiveTimeout = “00:00:30”>
</binding>
</wsDualHttpBinding>
</bindings>
</system.ServiceModel>

The same can be done through code, as illustrated here:

WSDualHttpBinding wsdb = new WSDualHttpBinding();
wsdb.ClientBaseAddress = “http://localhost:8080/client”;
wsdb.TransactionFlow = false;
wsdb.ReceiveTimeout = 30000;
wsdb.CloseTimeout = 30000;

Notes
The clientBaseAddress attribute, if specified, is a combination of the base address plus a per-channel GUID and is used for listening by the client to see if any responses are coming from the service. If this attribute is not specified, the client base address is created in a transport-specific manner.

Tagged . Bookmark the permalink.

Leave a Reply