G
Gilberto Araya
I have the following code that invokes a web service:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(wftUrl);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
// Prepare the request stream
StringBuilder requestContent = new StringBuilder("WFTXMLFEED=");
requestContent.Append(HttpUtility.UrlEncode(document.OuterXml));
byte[] encodedRequest = Encoding.UTF8.GetBytes(requestContent.ToString());
request.ContentLength = encodedRequest.Length;
using (Stream requestStream = request.GetRequestStream())
{
requestStream.Write(encodedRequest, 0, encodedRequest.Length);
requestStream.Close();
}
The previous code works fine most of the time, but every once in a while a
WebException indicating a timeout is thrown in the GetRequestStream() call.
A similar application using XMLHTTP (COM interfaces) never causes a timeout,
so I doubt it is a problem on the web service side...
Anyone who has an explanation for why this might be happening, or more
importantly, a solution for this problem, I would appreciate it if it is
posted here...
Thanks,
Gilberto Araya
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(wftUrl);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
// Prepare the request stream
StringBuilder requestContent = new StringBuilder("WFTXMLFEED=");
requestContent.Append(HttpUtility.UrlEncode(document.OuterXml));
byte[] encodedRequest = Encoding.UTF8.GetBytes(requestContent.ToString());
request.ContentLength = encodedRequest.Length;
using (Stream requestStream = request.GetRequestStream())
{
requestStream.Write(encodedRequest, 0, encodedRequest.Length);
requestStream.Close();
}
The previous code works fine most of the time, but every once in a while a
WebException indicating a timeout is thrown in the GetRequestStream() call.
A similar application using XMLHTTP (COM interfaces) never causes a timeout,
so I doubt it is a problem on the web service side...
Anyone who has an explanation for why this might be happening, or more
importantly, a solution for this problem, I would appreciate it if it is
posted here...
Thanks,
Gilberto Araya