Forum Moderators: open

Message Too Old, No Replies

Programatically accessing overture

Posting xml request to overture and getting response

         

usmansh

4:54 am on Jun 8, 2005 (gmt 0)



Hi!

Can anybody please tell me, how to send xml request programatically to overture server and get xml response. I am using the code given below to access overture. But in response, i get the html of [x-secure.overture.com...] Kindly answer this as soon as possible.

// Code Starts here

Uri strURL=new Uri("https://x-secure.overture.com/");
XmlDocument xdoc=new XmlDocument();
xdoc.Load(@"C:\Inetpub\wwwroot\XMLRequest\XMLFile1.xml");
string dtcrequest=xdoc.InnerXml.ToString();
string dtcrequest1=HttpUtility.UrlEncode(dtcrequest);
string postdata="xml="+dtcrequest1+"&_D:/go2/xml/xmlRequestHandler.submit= ";
ASCIIEncoding encoding=new ASCIIEncoding();
byte [] postbuffer=encoding.GetBytes(postdata);
HttpWebRequest request=(HttpWebRequest)WebRequest.Create(strURL+postdata);
request.Headers.Add("ContentType","application/x-www-form-urlencoded");
request.Headers.Add("ContentLength",postbuffer.Length.ToString());
request.Method="POST";
request.Timeout=10000;
request.KeepAlive=true;
Stream reqstream=request.GetRequestStream();
bool write=reqstream.CanWrite;
reqstream.Write(postbuffer,0,postbuffer.Length);
reqstream.Close();
HttpWebResponse response=(HttpWebResponse)request.GetResponse();
Response.ContentType="text/xml";
Stream respstream=response.GetResponseStream();
StreamReader sr=new StreamReader(respstream);
string res=sr.ReadToEnd();
sr.Close();
Response.Write(res);