HttpWebRequest returning different content type i.e., I need xml format
Devil Mukesh
here is the code I m using can you correct me
I'm not sure what you mean, i guess that the purpose is that you'd like send xml-file to the server. You'd like to know how should you attach the xml-file to the httpwebrequest, isn;t it? You could refer to the following links to know how to achieve it.
Member
402 Points
116 Posts
HttpWebRequest returning different content type i.e., I need xml format
Dec 22, 2015 11:10 AM|Devil Mukesh|LINK
here is the code I m using can you correct me
XmlDocument doc = new XmlDocument();
HttpWebRequest req;
req = (HttpWebRequest)WebRequest.Create("URL");
doc.Load(new MemoryStream(Encoding.ASCII.GetBytes(requestxml)));
req.ContentType = "text/xml;charset=\"utf-8\"";
req.Accept = "text/xml";
req.Method = "POST";
Stream stm = req.GetRequestStream();
doc.Save(stm);
stm.Close();
WebResponse resp = req.GetResponse();
stm = resp.GetResponseStream();
StreamReader r = new StreamReader(stm);
string response = r.ReadToEnd();
thanks in advance.. need asap :)
Star
8460 Points
1445 Posts
Re: HttpWebRequest returning different content type i.e., I need xml format
Dec 23, 2015 04:32 AM|Klein Zhang|LINK
Hi Devil Mukesh,
I'm not sure what you mean, i guess that the purpose is that you'd like send xml-file to the server. You'd like to know how should you attach the xml-file to the httpwebrequest, isn;t it? You could refer to the following links to know how to achieve it.
http://stackoverflow.com/questions/5653743/c-sharp-httpwebrequest-with-xml-structured-data
If I misunderstood you, please describe your question in more detail.
Best Regards,
Klein zhang
Member
402 Points
116 Posts
Re: HttpWebRequest returning different content type i.e., I need xml format
Dec 23, 2015 06:35 AM|Devil Mukesh|LINK
I am sending request in xml format so I want the response also in the xml format.
I am using WebResponse I posted my code. any Idea how we need to get xml response?