I\'m trying to figure out how to properly serialize my XmlDocument and send it via a HTTPWebRequest object.
Here\'s what I have thus far:
Stream reques
I'm guessing this question is related to the previous one about 2 xml documents not being able to be combined into one document without wrapping them both in a root node first (C# XmlDocument Nodes).
If that is the case then you don't want to be serialising the XmlDocuments and sending them to the WebService. Serializing the objects is for transporting/storing the actual object, not the data. You want to just send the webservice the data not the object so just concatenate the two xml documents and send that.
use XmlDocument.OuterXml to get the XmlDocument as a string. ie:
XmlDocument doc1 = new XmlDocument();
doc.LoadXml("Some XML");
XmlDocument doc2 = new XmlDocument();
doc2.LoadXml("Some other XML");
StringBuilder sb = new StringBuilder();
sb.Append(doc1.OuterXml);
sb.Append(doc2.OuterXml);
The just send sb.ToString() to the WebService.
Hope I haven't got completely the wrong end of the stick.