Get Just the Body of a WCf Message

前端 未结 2 2016
悲哀的现实
悲哀的现实 2020-12-19 04:00

I\'m having a bit of trouble with what should be a simple problem.

I have a service method that takes in a c# Message type and i want to just extract the body of tha

2条回答
  •  一向
    一向 (楼主)
    2020-12-19 04:36

    You can access the body of the message by using the GetReaderAtBodyContents method on the Message:

    using (XmlDictionaryReader reader = message.GetReaderAtBodyContents())
    {
         string content = reader.ReadOuterXml();
         //Other stuff here...                
    }
    

提交回复
热议问题