Announcement

Collapse
No announcement yet.

HTTP() problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • HTTP() problem

    Recently upgraded from 7.9 to 7.9.1 and the HTTP() function has started to behave strangely - sometimes working and sometimes not.

    I haven't been able to pin down the exact problem so can't give example code at this time. Does anybody know of any recent changes that may be causing problems with HTTP()? Specifically:

    PHP Code:
    var webFile "http://www.yourweb.com/afile.txt";
    var 
    = new HTTP(webFile);
    var 
    success f.open("rt"); 
    success is false.

    Thanks!
    Standing on the shoulders of giants.

  • #2
    I ran into something too..

    I had some code that was opening a file on the local computer. The problem was with the return value of f.open. It appears this function does not return "true" when opened.

    I've also had reports of other problems with the URL links of text buttons... But I don't have that problem on my esig..

    My current version is 7.91 (Build 738)

    ???
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Hello wildfiction,

      There hasn't been any modifications to this function recently. I just tested it on 7.9.1 build 738 and it is working on my end. The f.open() method is returning true in the code example I used. However, I was not calling it in the global scope. Try using the following code example and point it to your text file.

      PHP Code:
      var aArray = new Array(6); 

      function 
      preMain() { 
         
      //loadData(); 


      var 
      bInit false;

      function 
      main() {
          if (
      bInit == false) {
              
      loadData();
              
      bInit true;
          }
          
          return;
      }

      function 
      loadData() { 
          var 
      = new HTTP("http://www.yourweb.com/afile.txt");
          var 
      0

          
      f.open("rt"); 
          if (
      f.open()) {
              
      debugPrintln("File is open!");
              for (
      06; ++i) { 
                  
      aArray[i] = f.readln(); 
              } 
          } else {
              
      debugPrintln("File did NOT open.");
          }

          
      null
          
          
      debugPrintln(aArray); 
          
          return; 

      Jason K.
      Project Manager
      eSignal - an Interactive Data company

      EFS KnowledgeBase
      JavaScript for EFS Video Series
      EFS Beginner Tutorial Series
      EFS Glossary
      Custom EFS Development Policy

      New User Orientation

      Comment


      • #4
        I tried the following but it failed. The link is a file that exists on the web and you should be able to see it from a browser:


        PHP Code:
        function preMain() { 
           
        //loadData(); 


        var 
        bInit false;

        function 
        main() {
            if (
        bInit == false) {
                
        loadData();
                
        bInit true;
            }
            
            return;
        }
        var 
        aArray;

        function 
        loadData() { 
            var 
        = new HTTP("http://www.deltat1.com/holidays.txt");
            var 
        0

            
        f.open("rt"); 
            if (
        f.open()) {
                
        debugPrintln("File is open!");
                for (
        06; ++i) { 
                    
        aArray[i] = f.readln(); 
                } 
            } else {
                
        debugPrintln("File did NOT open.");
            }

            
        null
            
            
        debugPrintln(aArray); 
            
            return; 

        Can you try same from your end?

        My result is:
        File did NOT open.
        Standing on the shoulders of giants.

        Comment


        • #5
          Hello wildfiction,

          The code worked on my end after making one change to the code where you initialize aArray. It should be var aArray = new Array(6); After that it worked.



          The cause of the problem you are experiencing is outside the EFS environment. It may be related to your internet security settings, firewall or something of that nature.
          Attached Files
          Jason K.
          Project Manager
          eSignal - an Interactive Data company

          EFS KnowledgeBase
          JavaScript for EFS Video Series
          EFS Beginner Tutorial Series
          EFS Glossary
          Custom EFS Development Policy

          New User Orientation

          Comment


          • #6
            Originally posted by JasonK
            The cause of the problem you are experiencing is outside the EFS environment. It may be related to your internet security settings, firewall or something of that nature. [/B]
            Thanks for the help Jason.

            So how does the HTTP() function access the internet that differs from how a browser would access the internet? This info should help me track down what has started blocking the HTTP() call...
            Standing on the shoulders of giants.

            Comment


            • #7
              Not sure if anyone saw the next question that I had here:

              I can get info through my router and to the internet using a browser and other function calls from C#. So my question is: How does the HTTP() function access the internet that differs from a standard call to the internet? This should help me track down why the HTTP() call is getting blocked and other calls are going through...

              Thanks.
              Standing on the shoulders of giants.

              Comment


              • #8
                Hello Wildfiction,

                I've sent a request to development regarding your question about how the HTTP() object differs from a browser's call to internet files.
                Jason K.
                Project Manager
                eSignal - an Interactive Data company

                EFS KnowledgeBase
                JavaScript for EFS Video Series
                EFS Beginner Tutorial Series
                EFS Glossary
                Custom EFS Development Policy

                New User Orientation

                Comment


                • #9
                  Hello Wildfiction,

                  According to development, the HTTP() call uses the standard internet browser functions, InternetOpen(), InternetConnect(), HttpOpenRequest() etc. The code behind the scenes for this object has not been modified for quite some time.
                  Jason K.
                  Project Manager
                  eSignal - an Interactive Data company

                  EFS KnowledgeBase
                  JavaScript for EFS Video Series
                  EFS Beginner Tutorial Series
                  EFS Glossary
                  Custom EFS Development Policy

                  New User Orientation

                  Comment


                  • #10
                    Thanks Jason. This problem is still with me every day and causing problems with my indicators. 90% of the time HTTP() does not connect but 1 out of ever 10 it does connect. I'm completely lost for places to look for a solution at the moment so if you have any other suggestions about things that I could try they would be very welcome.
                    Standing on the shoulders of giants.

                    Comment


                    • #11
                      WildFiction:

                      I use the HTTP() function heavily and the only problems I have encountered are always internet-related (i.e., site down or slow-down on the internet, etc.).

                      A few things to keep in mind when using it:

                      1. Always prefix the url in question with http://

                      2. Always match the case of any files you are retrieving using HTTP() (i.e., MyFile.txt is not the same as myfile.txt).

                      3. Call it only when needed as it is a high-resource function call. Either call it once when the script initializes or call it when specific logic triggers.... don't call it on every iteration of main().

                      Chris

                      Comment


                      • #12
                        Many thanks for the reply Chris and your notes.

                        I am already doing exactly as you suggest. The call is only made in the initialization of the study. As you can see in the sample it loads a file of holiday dates and those are then stored in an array and referenced from the array when needed.

                        There are a number of people using this study each day and it appears that I am the only one suffering this problem.

                        I've just thought of something else:

                        The addEntitlement() is also called during the initiliasation stage of of the study (in the preMain). Perhaps development could take a look at the differences in web access between addEntitlement() and HTTP() and see what one does that the other doesn't. addEntitlement() appears to allways succeed and HTTP() fails 90% of the time.
                        Standing on the shoulders of giants.

                        Comment

                        Working...
                        X