views:

158

answers:

1

Hi there,

Basically, I want to get HTTP requests from a different source than a listening socket. However, since the provided bindings don't offer support for this, I am currently building my own binding.

My current binding consists of the WebMessageEncoder and of a custom TransportBindingElement, which references a custom ChannelListener which uses a custom channel which implements the IReplyChannel interface. The ServiceModel invokes the "receiveRequest" method, which should afterwards return a RequestContext.

However, the RequestContext class only contains a RequestMessage property where I should put in the Message object. As of this fact, I'm not sure where to put all the HTTP headers which are needed to match on UriTemplates in WebGet / WebInvoke attributes.

Could you please help me with this one? :)

Greetings

+1  A: 

The WebHttp dispatcher looks at two things, from what I remember:

  • The HttpRequestMessageProperty, which you should create and store in the Properties collection of the request message produced by your transport channel.
  • The URL associated with the request, which you want to make sure your transport channel fills in before passing the message down the channel stack (this should be saved in msg.Headers.To).
tomasr