다음을 통해 공유


WCF Null binding

I was testing some of my WCF code when I came up with this idea of using a 'Null binding'. Essentially, When you create a WCF service today, you also need a client which can send you message to get your service operations kicked off. The same is the case on the send side as well. When you want to check the client side functionalities you need to have a service to consume that message. This overhead of generating a test client/service and sending/receiving messages using them can sometimes be really time consuming.

Enter null binding. For testing purposes, this binding comes very handy. You can use this to receive automatically generate messages at specified time intervals. When sending WCF messages you can using this binding as a sink where all messages are just read and absorbed. You don't need to have an actual test client when testing your service.

This comes very useful with WCF adapter in BizTalk where we make use of * contracts.

Null binding is also useful for learning purposes. If you are new to WCF and looking for how to make a custom binding, this can give you a some ideas about how to implement one.

What more can be done:

On the receive side, add a string property which holds the schema for the desired body. At runtime, generate WCF messages using that schema.

NullBinding.zip

Comments

  • Anonymous
    October 08, 2011
    Great post.