tags:

views:

50

answers:

1

How can i use LINQ with ServiceModel.Channels.Message? I'd like to use LINQ to the SOAP message body.

I initially tried doing this:

XElement elem = XElement.load(message.GetReaderAtBodyContents());

But that piece of code complains that XMLReader should be EOF after the read operation. What is the correct way to do this?

A: 

OK, I think I found a solution:

XDocument document = XDocument.Parse(message.GetReaderAtBodyContents().ReadOuterXml());
hrnt