It takes more than 30 seconds to load and process a xml hosted in HTTPS

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<img alt="You cannot vote on your own post" src="http://i4.social.s-msft.com/globalresources/Images/trans.gif?cver=3145.220%0d%0a" title="You cannot vote on your own post I used following code to access a service hosted in https. The out put I need to
process is a xml document which takes too much time (30 seconds) after application being idle for more than 10 minutes. Please Help me finding the issue with this.

<span>


public LBSLocation GetLBSLocationInfo(string mobileNo)<br/>
{<br/>
LBSLocation location = new LBSLocation();<br/>
try<br/>
{<br/>
String URL ="https://125.214.169.85/gmlc/legacy?classID=web_engine_v2&methodID=Handler&username=abc&password=1234ff&clientcode=ABB&phoneno=777733773"
XmlDocument doc = new XmlDocument();<br/>
<br/>
HttpWebRequest rq = (HttpWebRequest)WebRequest.Create(URL);<br/>
<br/>
System.Net.ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(RemoteCertificateValidationCallback);<br/>
<br/>
<br/>
HttpWebResponse response = rq.GetResponse() as HttpWebResponse;<br/>
using (Stream responseStream = response.GetResponseStream())<br/>
{<br/>
XmlTextReader reader = new XmlTextReader(responseStream);<br/>
doc.Load(reader);<br/>
<br/>
<br/>
<br/>
<br/>
XmlNodeList nodeList = doc.GetElementsByTagName("location");<br/>
<br/>
for (int i = 0; i < nodeList.Count; i++)<br/>
{<br/>
XmlNode n = (XmlNode)nodeList;<br/>
<br/>
location.Latitude = n.ChildNodes[0].InnerText;<br/>
location.Longitude = n.ChildNodes[1].InnerText;<br/>
location.LocationName = n.ChildNodes[2].InnerText;<br/>
}<br/>
}<br/>
<br/>
<br/>
return location;<br/>
}<br/>
catch (Exception ex)<br/>
{<br/>
throw ex;<br/>
}<br/>
<br/>
}

public static bool RemoteCertificateValidationCallback(object sender, X509Certificate certificate,<br/>
X509Chain
chain, SslPolicyErrors errors)<br/>
{<br/>
return true;<br/>
}

Thank you,
Damith


View the full article
 
Back
Top