Using LINQ to XML to Parse a SOAP message?

If this is about interacting with a SOAP service please use Add Service Reference or wsdl. Exe .

Up vote 2 down vote favorite 3 share g+ share fb share tw.

I am getting up to speed in Linq to XML in C# and attempting to parse the following message and don't seem to be making much progress. Here is the soap message I am not sure if I perhaps I need to use a namespace. Here is the SOAP message I am trying to format.

Any help would be greatly appreciated. I am attempting to extract the values. Thanks.

1000 test I07 17090769 Y c# soap linq-to-xml link|improve this question edited Dec 2 '10 at 0:52John Saunders86.7k763144 asked Dec 1 '10 at 22:31Bill Lee112.

Or at least an example that demonstrates the problem. – Mike Chess Dec 1 '10 at 22:34 Any particular reason for manually parsing SOAP messages? – Darin Dimitrov Dec 1 '10 at 22:34.

If this is about interacting with a SOAP service please use Add Service Reference or wsdl.exe. If this is just about parsing the XML, assuming you've got the SOAP response into an XDocument named soapDocument: XNamespace ns = "http://ASR-RT/"; var objIns = from objIn in soapDocument. Descendants(ns + "objIn") let header = objIn.

Element(ns + "transactionHeaderData") select new { WebsiteId = (int) header. Element(ns + "intWebsiteId"), VendorData = header. Element(ns + "strVendorData").

Value, VendorId = header. Element(ns + "strVendorId"). Value, CCN = (int) objIn.

Element(ns + "intCCN"), SurveyResponse = objIn. Element(ns + "strSurveyResponseFlag"). Value, }; That will give you an IEnumerable of anonymous types you deal with as fully strongly typed objects within that method.

Thank you very much cameron, your answer helped me a lot I solved issue after a day search – Praveenb May 26 '11 at 11:42.

Use Linq's XDocument to load the XML text by calling XDocument.Load() or similar. Then you can walk through the tree of elements off the xdoc's Root, using functions like foreach (var x in xdoc. Elements("Lookup")) {...}.

I believe he needs xdoc. Elements(XName. Get("lookup", "ASR-RT/";)) as the Xml has a default namespace – dkackman Dec 1 '10 at 23:02.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions