Export (0) Print
Expand All

WS2007HttpRelayBinding Class

Represents an interoperable binding that derives from WSHttpRelayBinding and provides support for the updated versions of the Security, ReliableSession, and TransactionFlow binding elements.

Namespace:  Microsoft.ServiceBus
Assembly:  Microsoft.ServiceBus (in Microsoft.ServiceBus.dll)

public ref class WS2007HttpRelayBinding : public WSHttpRelayBinding

The WS2007HttpRelayBinding type exposes the following members.

  NameDescription
Public methodWS2007HttpRelayBinding()Initializes a new instance of the WS2007HttpRelayBinding class with a specified type of security used by the binding.
Public methodWS2007HttpRelayBinding(String)Initializes a new instance of the WS2007HttpRelayBinding class with a binding specified by its configuration name.
Public methodWS2007HttpRelayBinding(EndToEndSecurityMode, RelayClientAuthenticationType)Initializes a new instance of the WS2007HttpRelayBinding class with a specified type of security and relay client authentication used by the binding.
Public methodWS2007HttpRelayBinding(EndToEndSecurityMode, RelayClientAuthenticationType, Boolean)Initializes a new instance of the WS2007HttpRelayBinding class with a specified type of security used by the binding, the specified authentication for the client relay, and a value that indicates whether a reliable session is enabled.
Top

  NameDescription
Public propertyAllowCookiesGets or sets a value that indicates whether the client accepts cookies and propagates them on future requests. (Inherited from WSHttpRelayBinding.)
Public propertyCloseTimeout (Inherited from Binding.)
Public propertyEnvelopeVersionGets the version of SOAP that is used for messages that are processed by this binding. (Inherited from WSHttpRelayBindingBase.)
Public propertyHostNameComparisonModeGets or sets the comparison mode used on the host name. (Inherited from WSHttpRelayBindingBase.)
Public propertyIsDynamicGets or sets whether the relay binding is dynamic. (Inherited from WSHttpRelayBindingBase.)
Public propertyMaxBufferPoolSizeGets or sets the maximum amount of memory allocated for the buffer manager that manages the buffers required by endpoints using this Windows Azure Service Bus binding. (Inherited from WSHttpRelayBindingBase.)
Public propertyMaxReceivedMessageSizeGets or sets the maximum size for a message that can be processed by the Windows Azure Service Bus binding. (Inherited from WSHttpRelayBindingBase.)
Public propertyMessageEncodingGets or sets whether MTOM or Text/XML is used to encode SOAP messages. (Inherited from WSHttpRelayBindingBase.)
Public propertyMessageVersion (Inherited from Binding.)
Public propertyName (Inherited from Binding.)
Public propertyNamespace (Inherited from Binding.)
Public propertyOpenTimeout (Inherited from Binding.)
Public propertyProxyAddressGets or sets the URI address of the HTTP proxy. (Inherited from WSHttpRelayBindingBase.)
Public propertyReaderQuotasGets or sets constraints on the complexity of SOAP messages that can be processed by endpoints configured with this Security Bus binding. (Inherited from WSHttpRelayBindingBase.)
Public propertyReceiveTimeout (Inherited from Binding.)
Public propertyReliableSessionGets an object that provides convenient access to the properties of a reliable Windows Azure Service Bus session binding element that are available when using one of the system-provided bindings. (Inherited from WSHttpRelayBindingBase.)
Public propertySchemeGets the URI transport scheme for the channels and listeners that are configured with this binding. (Inherited from WSHttpRelayBindingBase.)
Public propertySecurityGets the security settings used with this binding. (Inherited from WSHttpRelayBinding.)
Public propertySendTimeout (Inherited from Binding.)
Public propertyTextEncodingGets or sets the character encoding that is used for the message text. (Inherited from WSHttpRelayBindingBase.)
Public propertyUseDefaultWebProxyGets or sets a value that indicates whether the auto-configured HTTP proxy of the system should be used, if available. (Inherited from WSHttpRelayBindingBase.)
Top

  NameDescription
Public methodBuildChannelFactory<TChannel>(array<Object>) (Inherited from Binding.)
Public methodBuildChannelFactory<TChannel>(BindingParameterCollection) (Inherited from Binding.)
Public methodBuildChannelListener<TChannel>(array<Object>) (Inherited from Binding.)
Public methodBuildChannelListener<TChannel>(BindingParameterCollection) (Inherited from Binding.)
Public methodBuildChannelListener<TChannel>(Uri, array<Object>) (Inherited from Binding.)
Public methodBuildChannelListener<TChannel>(Uri, BindingParameterCollection) (Inherited from Binding.)
Public methodBuildChannelListener<TChannel>(Uri, String, array<Object>) (Inherited from Binding.)
Public methodBuildChannelListener<TChannel>(Uri, String, BindingParameterCollection) (Inherited from Binding.)
Public methodBuildChannelListener<TChannel>(Uri, String, ListenUriMode, array<Object>) (Inherited from Binding.)
Public methodBuildChannelListener<TChannel>(Uri, String, ListenUriMode, BindingParameterCollection) (Inherited from Binding.)
Public methodCanBuildChannelFactory<TChannel>(array<Object>) (Inherited from Binding.)
Public methodCanBuildChannelFactory<TChannel>(BindingParameterCollection) (Inherited from Binding.)
Public methodCanBuildChannelListener<TChannel>(array<Object>) (Inherited from Binding.)
Public methodCanBuildChannelListener<TChannel>(BindingParameterCollection) (Inherited from Binding.)
Public methodCreateBindingElementsReturns an ordered collection of binding elements contained in the current Windows Azure Service Bus binding. (Inherited from WSHttpRelayBindingBase.)
Protected methodCreateMessageSecurityRetrieves the security binding element from the current binding. (Overrides WSHttpRelayBinding::CreateMessageSecurity().)
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetProperty<T> (Inherited from Binding.)
Protected methodGetTransportReturns the transport binding element from the current binding. (Inherited from WSHttpRelayBinding.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodShouldSerializeName (Inherited from Binding.)
Public methodShouldSerializeNamespace (Inherited from Binding.)
Public methodToString (Inherited from Object.)
Top

  NameDescription
Explicit interface implemetationPrivate propertyIBindingRuntimePreferences::ReceiveSynchronouslyGets a value that indicates whether incoming requests can be handled more efficiently synchronously or asynchronously. (Inherited from WSHttpRelayBindingBase.)
Top

The WS2007HttpRelayBinding is very closely aligned with the standard WS2007HttpBinding in the that supersedes the WsHttpBinding with updated standards support. The key difference between the standard WS2007HttpBinding and the WS2007HttpRelayBinding is that the latter variant creates publicly reachable and, if desired, publicly discoverable HTTP listener endpoint listening on the cloud-based Windows Azure Service Bus, while the standard binding listens through the standard HTTP.sys listener on the local Windows computer.

With its default settings, the WS2007HttpRelayBinding supports SOAP 1.2 messaging with the latest OASIS standards for Reliable Message Exchange and Security.

Services using the WS2007HttpRelayBinding are registering their endpoints on the Windows Azure Service Bus using the "http" or "https" URI scheme. Client channels created using the WS2007HttpRelayBinding use HTTP or HTTPS on the default TCP ports 80 and 443 as the transport mechanism to talk to the respective endpoint in the Windows Azure Service Bus cloud. Service listeners created using this binding are using a pair of TCP socket connections to the cloud-based listener. The SSL-protected control channel is using outbound TCP port 828, while the data channel is using outbound port 818. The data channel is SSL-protected if the endpoint URI scheme is "https" and the Security.Mode property is set to one of the EndToEndSecurityMode values: Transport or TransportWithMessageCredential.

The following example shows how to define and use WS2007HttpRelayBinding with the default configuration for a service and client in an application configuration file.

<system.serviceModel>

  <bindings>
    <!-- Application Binding -->
    <ws2007HttpRelayBinding>
      <binding name="default" />
    </ws2007HttpRelayBinding>
  </bindings>

  <client>
    <!-- Application Endpoint -->
    <endpoint name="RelayEndpoint"
              contract="Microsoft.ServiceBus.Samples.IMyContract"
              binding="ws2007HttpRelayBinding"
              bindingConfiguration="default"
              behaviorConfiguration="ReplaceWithEndpointBehaviorName"
              address="ReplaceWithEndpointAddress" />
  </client>

  <services>
    <service name="Microsoft.ServiceBus.Samples.MyService">
      <!-- Keep address empty to use host base address, or -->
      <!-- replace with endpoint address. -->
      <endpoint name="RelayEndpoint"
                contract="Microsoft.ServiceBus.Samples.IMyContract"                   
                binding="ws2007HttpRelayBinding" 
                bindingConfiguration="default"
                behaviorConfiguration="ReplaceWithEndpointBehaviorName"
                address="" />
    </service>
  </services>

  <behaviors>
    <endpointBehaviors>
      <!-- Add endpoint behavior here. -->
    </endpointBehaviors>
  </behaviors>

</system.serviceModel>

The following example is similar to the previous example except that it defines a custom configuration for WS2007HttpRelayBinding. It turns off the security mode and client authentication, which means that SOAP messages are sent unsecured and that the client is not required to present a security token to the Windows Azure Service Bus.

<system.serviceModel>

  <bindings>
    <!-- Application Binding -->
    <ws2007HttpRelayBinding>
      <binding name="customBinding">
        <!-- Turn off SSL and client authentication -->
        <security mode="None" relayClientAuthenticationType="None" />
      </binding>
    </ws2007HttpRelayBinding>
  </bindings>

  <client>
    <!-- Application Endpoint -->
    <!-- No behavior configuration is added to this endpoint as the client does not need to authenticate. -->
    <endpoint name="RelayEndpoint"
              contract="Microsoft.ServiceBus.Samples.IMyContract"
              binding="ws2007HttpRelayBinding"
              bindingConfiguration="customBinding"
              address="ReplaceWithEndpointAddress" />
  </client>

  <services>
    <service name="Microsoft.ServiceBus.Samples.MyService">
      <!-- Keep address empty to use host base address, or -->
      <!-- replace with endpoint address. -->
      <endpoint name="RelayEndpoint"
                contract="Microsoft.ServiceBus.Samples.IMyContract"                   
                binding="ws2007HttpRelayBinding" 
                bindingConfiguration="customBinding"
                behaviorConfiguration="ReplaceWithEndpointBehaviorName"
                address="" />
    </service>
  </services>

  <behaviors>
    <endpointBehaviors>
      <!-- Add endpoint behavior here. -->
    </endpointBehaviors>
  </behaviors>

</system.serviceModel>

The following example illustrates the use of WS2007HttpRelayBinding programmatically with its default settings. The default settings of WS2007HttpRelayBinding for the end-to-end security mode and client authentication type are EndToEndSecurityMode.Transport and RelayClientAuthenticationType.RelayAccessToken respectively.

This example starts by specifying the credentials the service and the client are expected to send to the Windows Azure Service Bus by creating an endpoint behavior. Next, it creates the binding, the service address, and starts the service host. After starting the service, a channel factory is created for the IMyChannel channel type that is used to generate a client channel to the service. Finally, the client channel is opened.

// Configure the credentials through an endpoint behavior.
TransportClientEndpointBehavior relayCredentials = new TransportClientEndpointBehavior();
relayCredentials.CredentialType = TransportClientCredentialType.SharedSecret;
relayCredentials.Credentials.SharedSecret.IssuerName = issuerName;
relayCredentials.Credentials.SharedSecret.IssuerSecret = issuerSecret;

// Create the binding with default settings.
WS2007HttpRelayBinding binding = new WS2007HttpRelayBinding();

// Get the service address.
// Use the https scheme because by default the binding uses SSL for transport security.
Uri address = ServiceBusEnvironment.CreateServiceUri("https", serviceNamespace, "MyService");

// Create the service host.
ServiceHost host = new ServiceHost(typeof(MyService), address);
// Add the service endpoint with the WS2007HttpRelayBinding.
host.AddServiceEndpoint(typeof(IMyContract), binding, address);
// Add the credentials through the endpoint behavior.
host.Description.Endpoints[0].Behaviors.Add(relayCredentials);
// Start the service.
host.Open();

// Create a channel factory for the specified channel type.
// This channel factory is used to create client channels to the service. 
// Each client channel the channel factory creates is configured to use the 
// WS2007HttpRelayBinding that is passed to the constructor of the channel. 
factory.ChannelFactory<IMyChannel> channelFactory = new ChannelFactory<IMyChannel>(
    binding, new EndpointAddress(address));
channelFactory.Endpoint.Behaviors.Add(relayCredentials);

// Create and open the client channel.
IMyChannel channel = channelFactory.CreateChannel();
channel.Open();

The following example is similar to the previous example except that it uses WS2007HttpRelayBinding with custom settings. It turns off the SSL security mode and client authentication, which means that SOAP messages are sent unsecured and that the client is not required to present a security token to the Windows Azure Service Bus. Because SSL is turned off, the http scheme is used in the service address. Also, since the client is not required to authenticate, no endpoint behavior for the credentials is added to the client channel. Note that the behavior is still added to the service endpoint because the service application always authenticates with the Windows Azure Service Bus.

// Configure the credentials through an endpoint behavior.
TransportClientEndpointBehavior relayCredentials = new TransportClientEndpointBehavior();
relayCredentials.CredentialType = TransportClientCredentialType.SharedSecret;
relayCredentials.Credentials.SharedSecret.IssuerName = issuerName;
relayCredentials.Credentials.SharedSecret.IssuerSecret = issuerSecret;

// Create the binding with custom settings.
WS2007HttpRelayBinding binding = new WS2007HttpRelayBinding();
// SOAP messages are not SSL-protected.
binding.Security.Mode = EndToEndSecurityMode.None;
// The client is not required to present a security token to the
// AppFabric Service Bus.
binding.Security.RelayClientAuthenticationType = RelayClientAuthenticationType.None;

// Get the service address.
// Use the http scheme because SSL security is turned off in our binding.
Uri address = ServiceBusEnvironment.CreateServiceUri("http", serviceNamespace, "MyService");

// Create the service host.
ServiceHost host = new ServiceHost(typeof(MyService), address);
// Add the service endpoint with the WS2007HttpRelayBinding.
host.AddServiceEndpoint(typeof(IMyContract), binding, address);
// Add the credentials through the endpoint behavior.
host.Description.Endpoints[0].Behaviors.Add(relayCredentials);
// Start the service.
host.Open();

// Create a channel factory for the specified channel type.
// We do not add the endpoint behavior with the credentials to the channel 
// factory because client authentication is turned off in the binding used.
// This channel factory is used to create client channels to the service. 
// Each client channel the channel factory creates is configured to use the 
// WS2007HttpRelayBinding that is passed to the constructor of the channel. 
factory.ChannelFactory<IMyChannel> channelFactory = new ChannelFactory<IMyChannel>(
    binding, new EndpointAddress(address));

// Create and open the client channel.
IMyChannel channel = channelFactory.CreateChannel();
channel.Open();

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

Community Additions

ADD
Show:
© 2014 Microsoft