2

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:

  1. Deserialize the request body
  2. 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.

G S
  • 35,511
  • 22
  • 84
  • 118

1 Answers1

1

Why not take a look at the Web API project (http://wcf.codeplex.com)? It uses WCF under the covers and it does what you are describing.

Darrel Miller
  • 139,164
  • 32
  • 194
  • 243