Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How do i reduce xml file reading time ???

    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.
    Code:
          public LBSLocation GetLBSLocationInfo(string mobileNo)
            {
                LBSLocation location = new LBSLocation();
                try
                {
                    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();
    
                    HttpWebRequest rq = (HttpWebRequest)WebRequest.Create(URL);
    
                    System.Net.ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(RemoteCertificateValidationCallback);
    
    
                    HttpWebResponse response = rq.GetResponse() as HttpWebResponse;
                    using (Stream responseStream = response.GetResponseStream())
                    {
                        XmlTextReader reader = new XmlTextReader(responseStream);
                        doc.Load(reader);
    
    
    
    
                        XmlNodeList nodeList = doc.GetElementsByTagName("location");
    
                        for (int i = 0; i < nodeList.Count; i++)
                        {
                            XmlNode n = (XmlNode)nodeList[i];
    
                            location.Latitude = n.ChildNodes[0].InnerText;
                            location.Longitude = n.ChildNodes[1].InnerText;
                            location.LocationName = n.ChildNodes[2].InnerText;
                        }
                    }
    
    
                    return location;
                }
                catch (Exception ex)
                {
                    throw ex;
                }
    
            }
    
            public static bool RemoteCertificateValidationCallback(object sender, X509Certificate certificate,
                                               X509Chain chain, SslPolicyErrors errors)
            {
                return true;
            }
    Last edited by Alex Vincent; 06-22-2012 at 05:03 PM. Reason: adding code tags

  • #2
    Moderator
    Join Date
    May 2002
    Location
    Hayward, CA
    Posts
    1,460
    Thanks
    1
    Thanked 23 Times in 21 Posts
    * What language is that script written in?
    * How big is your XML document?
    * Your HTTPS certificate is failing. Why?
    * Do you have extra whitespace that might be slowing down processing?
    * Are you using gzip compression in your HTTP download?
    * Does your user need every single bit of that information immediately? (Pagination might help.)
    * Why are you passing the username and password in the query string?
    "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
    June 30, 2001
    author, Verbosio prototype XML Editor
    author, JavaScript Developer's Dictionary
    https://alexvincent.us/blog


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •