all groups > dotnet xml > january 2005 >
You're in the

dotnet xml

group:

The operation has timed-out ; HttpWebResponse.GetResponse()


The operation has timed-out ; HttpWebResponse.GetResponse() laks
1/5/2005 3:18:14 PM
dotnet xml: Hi all

I have the following piece of code for retrieving some info from an
external url. I receive an error - "The operation has timed-out" at
GetResponse() line. I have tried extending the time out duration. I
dont have any SETI etc on my computer. Anything wrong in code? how can
i resolve my issue?

Any insight highly appreciated..
thanks
laks..

------------------------------------------

strXmlRequest = "Something in xml";

XmlDocument xmlDoc;
xmlDoc = new XmlDocument();
xmlDoc.LoadXml(strXmlRequest);

// Create an HTTP request to do a POST
System.Net.HttpWebRequest xmlHttpRequest = (HttpWebRequest)
WebRequest.Create("http://www.somesite.com/ExtInterface/ListingSearch.asp");xmlHttpRequest.Method="POST";

// Write the serialized XML to the request.
XmlTextWriter xmlWriter = new
XmlTextWriter(xmlHttpRequest.GetRequestStream(),
Encoding.GetEncoding("UTF-8"));
xmlDoc.WriteTo(xmlWriter);

// Force the XML text writer to finish
xmlWriter.Flush();

// Get the response from the server
System.Net.HttpWebResponse xmlHttpResponse = (HttpWebResponse)

xmlHttpRequest.GetResponse();

// Parse the response into a new XmlDocument and return it.
XmlDocument respDoc = new XmlDocument();
respDoc.Load(xmlHttpResponse.GetResponseStream());
xmlHttpResponse.Close();
------------------------------------------------
Re: The operation has timed-out ; HttpWebResponse.GetResponse() laks
1/7/2005 7:49:25 AM
insert line xmlWriter.Close() after the flush stmt. That fixed the
isue.
AddThis Social Bookmark Button