I'm writing a WCF REST service and trying to use the ideas in Carlos Figueira's blog post here to customize my deserialization.
There's just one problem. I'd like my custom IDispatchMessageFormatter.DeserializeRequest()
to both:
- Deserialize the request body
- And parse the URI into method parameters (just as WCF by default does).
For example, if I have the below method in my service contract:
[WebInvoke(Method = "POST", UriTemplate = "/{uriPart1}/{uriPart2}")]
void Func(string uriPart1, string uriPart2, SomeObject messageBodyObject);
then my DeserializeRequest()
implementation should not only deserialize the POST message body into messageBodyObject
, it should also assign the correct values from the URI to uriPart1
, uriPart2
parameters.
Carlos's code does not do the second part.
I'd like to know how I can achieve this. Any help will be much appreciated.