WCF REST - how to read Stream to text -


i have wcf rest service. xml body of each incoming message deserialized objects follows:

            private static message mymethod(stream stream)             {                 try                 {                     var serializer = new xmlserializer(typeof(myobject));                     var myobject = (myobject)serializer.deserialize(stream);                     //do stuff                 }                 catch (invalidoperationexception invex)                 {                     //write stream (xml) error log                 }                 //etc              } 

i able write xml log when deserialization fails. have tried results in empty string. possible?

thanks!

you bring whole thing in string rather stream, , load/deserialize that. there particular reason stream?

alternatively (better, imo), can specify object want de-serialized datacontract , require xml in operation contract , let wcf framework work for you.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -