How do i reduce xml file reading time ???

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
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.
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" target="_blank https://125.214.169.85/gmlc/<wbr>legacy?classID=web_engine_v2&<wbr>methodID=Handler&username=abc&<wbr>password=1234ff&clientcode=<wbr>ABB&phoneno=777733773 "
XmlDocument doc = new XmlDocument();<br/>
<br/>
HttpWebRequest rq = (HttpWebRequest)WebRequest.<wbr>Create(URL);<br/>
<br/>
System.Net.<wbr>ServicePointManager.<wbr>ServerCertificateValidationCal<wbr>lback = new System.Net.Security.<wbr>RemoteCertificateValidationCal<wbr>lback(<wbr>RemoteCertificateValidationCal<wbr>lback);<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("<wbr>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 RemoteCertificateValidationCal<wbr>lback(object sender, X509Certificate certificate,<br/>
<wbr>
X509Chain chain, SslPolicyErrors errors)<br/>
{<br/>
return true;<br/>
}

View the full article
 
Back
Top