tags:

views:

127

answers:

1

Hi.

Consider the following picture representing the WCF channel stack:

alt text

I'm implementing my own channel and for that i already implemented the transport and encoding layer. Now i need to create a "protocol channel" layer where the messages should pass after created in encode layer and before get in the service layer.

I guess i need to create a BindingElement whose implements some interface and then add these bindingElement to my Binding. But all documentation i can find just explains how to implement the transport and encoding layers...

Any help? Thanks

A: 

As far as I remember, it's pretty much the same thing, meaning you implement a BindingElement as you mentioned, and override the BuildChannelFactory/BuildChannelListener methods to return the factory/listeners for your custom protocol channel.

The difference is that you'll use BindingContext.BuildInnerChannelFactory() and BuildInnerChannelListener() methods to layer your custom channel factory/listener on top of the ones in lower levers of the stack (like your transport channel).

Does that make sense?

tomasr
I spend the last 2 days working on this. I'll accept your answer since all you said that's right but the final implementation is much complex than your answer could suggest. The trick here is to provide each channel with an instance for inner channel (the below in stack). For who are reading this having the same problem, this link will be very usefull: http://www.developer.com/net/net/article.php/3676161/Building-WCF-Channels-and-Bindings.htm
Zé Carlos