Manipulate XML File

G

Guest

Garth,

You make a post like this (I'm posting an XML here):

using System.Net;

HttpWebRequest request = (HttpWebRequest)
WebRequest.Create(alurl);
request.Method = "POST";
request.ContentType = "text/xml";
Stream postStream = request.GetRequestStream();
StreamWriter sw = new StreamWriter(postStream);
sw.Write(xml);
sw.Flush();
sw.Close();
// reading
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
response.Close();

To parse XML:

using System.Xml;

XmlDocument formDoc = new XmlDocument();
formDoc.LoadXml(xmlString);
formDoc.GetElementsByTagName("sometag");

Hope this helps

Ed.
 
G

Garth Wells

Assume you're working with a vendor that doesn't understand web
services and implements their version of a web service solution that
only returns an XML file upon making a call to a URL:

http://333.333.333.90:7900/UserVerify?UserID=abc&Password=123

There is no disco file of any sort, so I'm forced to write code that does
a post/get and captures the XML file returned and parses it manually to
get to the data.

Using a .Net solution, what's the best approach to solving this problem?

Thanks for any pointers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top