2

I have a web api rest service set up and can use the httpclient + json.net formatter to use it without any problems. But i want to implement this usage with a channel factory and replace the default json serializer there with json.net formatter(WITHOUT CHANGING ANYTHING IN THE SERVICE). I've seen two examples of this(both based on the same code): https://github.com/carlosfigueira/WCFSamples/tree/master/MessageFormatter/MessageFormatter/JsonNetMessageFormatter But what they're doing is changing the service part to return data in a different way. The problem here could be easily fixed if I could somehow get the RAW body data of the response. The sample pasted above gets the json data using the XmlDictionaryReader which is received in the IClientMessageFormatter's DeserializeReply funcion. Json.Net does not support deserialization from XmlDictionaryReader so I guess this data must be received/deserialized somewhere higher in the stack. Or maybe somebody here knows of a way to get the raw body data(json string...) inside the DeserializeReply function?

The problem is only in the deserialization of the reply. Sending works without issues(SerializeRequest)

Has anyone successfully tackled this problem?

Looooooka
  • 99
  • 1
  • 3
  • Work in progress but it's already working with simpleobjects. Haven't tested it with object that contain lists...plus there's a lot of garbage code there but at least i'm getting my object back :) http://pastebin.com/kAWm7yDG – Looooooka Oct 29 '13 at 01:06

1 Answers1

0

Got it working with lists as well: http://pastebin.com/UU05tNRj

DateTime values are converted to LocalDateTime. Question closed :)

Looooooka
  • 99
  • 1
  • 3