Well, basically, you can request an XML document something like this (no try/catch here - but you should definitely add that!):
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url);
myRequest.Method = "POST"; // or GET - depends
myRequest.ContentType = "text/xml; encoding=utf-8";
myRequest.ContentLength = data.Length;
using (Stream reqStream = myRequest.GetRequestStream())
{
// Send the data.
reqStream.Write(data, 0, data.Length);
reqStream.Close();
}
// Get Response
WebResponse myResponse;
myResponse = myRequest.GetResponse();
XmlDocument _xmlDoc = new XmlDocument();
using (Stream responseStream = myResponse.GetResponseStream())
{
_xmlDoc.Load(responseStream);
}
Whether you have a GET or POST depends on your scenario - in a GET, you won't have request data going out.
Once you have your XML back as a XmlDocument, you can either validate that against the XML schema, or just try to deserialize it into the type that is represented by the XSD schema you have.
If that works --> the XML you got is valid and OK. If not, you'll get an exception on deserialization.
Marc