WCF BasicHttpBinding equivalent CustomBinding

By admin - Last updated: Wednesday, August 6, 2008 - Save & Share - 3 Comments

In real world , web service of WCF in basichttpbinding might not be flexible enough to meet enterprise application requirements.
What programmers are looking at is a more robust way of developing web service application in WCF. CustomBinding as the name describes that it alllows users design their own web service binding.
At the point, people might think it will lose the captibilities of interoperabilities provided by basichttpbinding.

In fact, a custombinding can easily emulate basichttpbinding for your service contracts.
Moreover, the custombinding emulating basichttpbinding makes the basichttpbinding more configurable.
For example, you can change the threshold values of ClockSkew which is 5 mins in basichttpbinding. Here we have an example that using UserName clientCredentialType, it also implies the underlying transport must be using HTTPS.

A BasicHttpBinding with UserName authentication in SOAP header within request message over HTTPS transport.

<basicHttpBinding>
    <binding name=“mySecureBasicHttpBinding”>
      <security mode=“TransportWithMessageCredential”>
        <transport clientCredentialType=“None” />
        <message clientCredentialType=“UserName” />
      </security>
    </binding>
  </basicHttpBinding>

Equivalent CustomBinding of BasicHttpBinding above with more controls from configuration point of view.
The customBinding below was designed in a way of fulfilling the specifications built in the basicHttpBinding.

<customBinding>
    <binding name=“myCustomBindingForEmulatingSecureBasicHttpBinding”>
      <security authenticationMode=“UserNameOverTransport”>
        <localClientSettings maxClockSkew=“00:30:00”/>
        <localServiceSettings maxClockSkew=“00:30:00”/>
      </security>
      <textMessageEncoding messageVersion=“Soap11” />
      <httpsTransport />
    </binding>
 </customBinding>

If client application were generated and pointing to a service endpoint configured with the first example i.e. mySecureBasicHttpBinding,
it would still work if the client pointed to the service endpoint configured with the binding in the second example i.e. myCustomBindingForEmulatingSecureBasicHttpBinding ( with maxClockSkew configured )

PS: One service contract can be exposed by one or many endpoints with different bindings. In this case, two service endpoints can be configured to use both
mySecureBasicHttpBinding and myCustomBindingForEmulatingSecureBasicHttpBinding.




Posted in Security, WCF • Tags: , , , , Top Of Page

3 Responses to “WCF BasicHttpBinding equivalent CustomBinding”

Comment from Lucian
Time April 30, 2009 at 4:18 am

Thanks alot! 🙂
I was looking for an example like this since 3 days.

Comment from WCF CustomBinding / Custom Transport
Time March 7, 2010 at 4:46 am

Using CustomBinding/httpTransport works a-ok for me as well. However, with CustomBinding/myCustomTransport, the SOAP11 envelope includes addressing headers. I was surprised because I thought the “XMLs” would be identical between CustomBinding/httpTransport and CustomBinding/myCustomTransport.

The real problem is now I cannot consume the WCF service with CustomBinding/myCustomTransport.

Anyone knows how to ensure CustomBinding/myCustomTransport would behave identical to CustomBinding/httpTransport? Of course, rather than http transport, I would ship the SOAP using my own transport.

Thanks…

Comment from Ray
Time March 7, 2010 at 3:06 pm

It would be useful if you post your binding configuration here..
Especially, what exactly does your customeTransport do?

Write a comment


Captcha: 3 + = six