views:

571

answers:

2

Hi, something seems very wierd to me, I have tried to look inside WCF with Reflector but forgive me it's too hard to understand :(.

When client A call a duplex service on server B with wsDualHttpBinding, I was thinking that client A include the client base address (the address of the callback) in the header of the request like this

<a:ReplyTo>http://client.foo/29293-3287-2387-3291&lt;/a:ReplyTo&gt;

.

But OperationContext.Current.IncomingMessageHeaders.ReplyTo returns null...

How wsDualHttpBinding is doing to know the address of the client channel ????

Is there some black magic or something ?

Solution

This is the reliable session which is responsible to transport the replyTo address. We can verify this with these binding elements in a customBinding

<reliableSession/>
<compositeDuplex/>
<oneWay></oneWay>
<textMessageEncoding></textMessageEncoding>
<httpTransport/>

Remove the reliableSession and your service have not the callback channel anymore...

A: 

When I work with sockets, the caller's address is also available - my guess is that knowing to which address you'd need to reply to is a pretty low level feature of network communication...

flq
It can be possible in with a non duplex binding, but duplex binding use IOutputChannel/IInputChannel (the lowest level of abstraction of WCF) these channel can just recieve or send but not both, so I don't think it's here. I'm verifying with reflector maybe you are right.
Nicolas Dorier
+1  A: 

I think this information is passed via messages when establishing the session. If you use a tool like "fiddler" to watch all the http traffic, my hunch is you'll see it in an initial session setup message. No magic, the client has to tell the server 'where to call back'.

Brian
Fiddler don't show the traffic between two endpoints on the same machine do you have any other solution ?
Nicolas Dorier
Message logging?http://msdn.microsoft.com/en-us/library/aa702726.aspxhttp://blogs.msdn.com/madhuponduru/archive/2006/05/18/601458.aspx
Brian
Put a dot (.) in the url: http://localhost./MyService/Service.svc and fiddler will pick it up.
Jonathan Parker
Great tip for fiddler ! I try message logging too.
Nicolas Dorier