Connecting Tech Pros Worldwide Help | Site Map

getting an error in receiving WebResponse

Newbie
 
Join Date: Jan 2009
Posts: 1
#1: Jan 27 '09
hi All,
I have written the following code to get a webresponse.
Expand|Select|Wrap|Line Numbers
  1. XmlDocument myxmlDoc1 = new XmlDocument();
  2. myxmlDoc1.LoadXml(BkXMLRQ);
  3.  
  4. string s = myxmlDoc1.OuterXml;
  5. System.Text.ASCIIEncoding encoding1 = new System.Text.ASCIIEncoding();
  6. Byte[] byt1 = encoding.GetBytes(myxmlDoc1.OuterXml);
  7.  
  8. WebRequest httpRQ = WebRequest.Create(InterfaceURL);
  9. httpRQ.ContentType = "text/xml";
  10. httpRQ.ContentLength = BkXMLRQ.Length;
  11. httpRQ.Method = "POST";
  12. //httpRQ.Timeout = 90000;
  13.  
  14. System.IO.Stream ioStream1 = httpRQ.GetRequestStream();
  15. ioStream1.Write(byt1, 0, byt1.Length);
  16.  
  17. //It Gets Stuck Here
  18. WebResponse httpRes = httpRQ.GetResponse();
  19. System.IO.Stream ResStream1 = httpRes.GetResponseStream();
  20.  
the execuion gets stuck at "WebResponse httpRes = httpRQ.GetResponse();". it doesn't throw any any error but just gets hanged up. the xml request generated is correct as it gives me the response with Altova xmlspy.

Can anyone please spot out the mistake in this code.


Thanks
Reply