Announcement

Collapse
No announcement yet.

http object

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

  • http object

    Greetings,

    My efs application contacts a web page, looking for a one line response. The generic code is:

    vWebObj =new HTTP("http://www.tic2tic.com/WaveTracker.asp?sym=" + getSymbol() );
    if (vWebObj.open())
    debugPrint (vWebObj.readln())


    The contacted asp web page uses the 'Response' object to write the one line response.

    The good news is that it 'sometimes' works. When it does not work, what happens is that the http object (vWebObj) reads the first line of html on the asp page. I have not been able to figure out why it sometimes works and sometimes does not, so I have the web page write to a text file when it receives a message from the efs study and then have the efs application read the text file. That works fine as a workaround, but I would like to have the http object reliably read directly the output sent by the web page. Has anyone else seen this problem, or know of a solution?

    Thanks,

    Scott
    Scott Masters
    www.tic2tic.com
    [email protected]

  • #2
    Hi Scott,

    I haven't heard of any read problems before.

    Are you saying it only reads one line of text before finishing? How large is that line of text? (or is it just the <html> tag?).

    Can you give me an example of the output when it does and does not work. I'm not sure I understand, as you mention that when it does NOT work, it only reads the first line of HTML, which seems like what you need it to do?

    Thanks!

    Comment


    • #3
      I think...

      The issue here is the delay in processing the ASP information on the page. I'm using the HTTP object to pull data from a txt file on a server with no problems. Yeah, there is a delay while the DNS server find and pull the txt file..

      But I'm thinking the problem sMasters is having is related to the responce time from his servers..

      Why don't you create a "delay loop" after you call the "open" command (possibly about 4~8 seconds) to allow the ASP page to process the information, then start reading the data??

      I've had to use delays for things like NinjaTrader, CyberTrader and others. Sometimes, EFS is simply too fast..

      B
      Brad Matheny
      eSignal Solution Provider since 2000

      Comment


      • #4
        Just to be clear, the web page writes a line of text using the ASP response object, like:

        <html>
        <%Response.Write ("Hello")%>
        </html>

        So if you ran this page from your browser, you would get "Hello". When the page is opened from my HTTP object and then read (inside of EFS), sometimes I get "Hello" and sometimes I get "<html>".

        Scott
        Scott Masters
        www.tic2tic.com
        [email protected]

        Comment


        • #5
          This is directly from the help file..

          The HTTP object allows EFS to open a file from a URL to import data for use within the EFS script. The HTTP functionality can be used to read text files (e.g., .txt, .htm, .html, .xml, etc.)

          As I read this, I see OPEN TEXT FILES.. So, it makes sense why you are getting <HTML>.... that is the first line of your ASP doc.

          Maybe you should try using the HTTP obj to OPEN the ASP doc, then have the ASP doc save the required data to your server. Then use another HTTP obj to open this TXT (data) file.

          I've used the HTTP obj to open TXT files directly from different servers (no problem). But I'll bet you are just pushing the boundaries of the HTTP obj a bit (using ASP to return data).

          As it is writen, it OPENS A TEXT FILE, thus your source ASP doc - not the result of that doc. The fact that you can SOMETIMES get it to return the proper value is probably due to "RESPONSE TIME" and I would try a delay to see if that helps to resolve the problems.

          Generally, you're treading thru untested grounds and will have to play with it for a while.. Try some of the options I've suggested.

          B
          Brad Matheny
          eSignal Solution Provider since 2000

          Comment


          • #6
            Scott:

            Browse to any web page and then select the "View Source" option in your browser. That is what the HTTP object is seeing. In order to extract the text you want, you need to cycle through the lines of HTML and pull out the pieces you need while discarding the rest.

            A simple example based on your description is attached.

            Chris
            Attached Files

            Comment


            • #7
              THE ASP PAGE DOES EXECUTE

              Chris,

              Thanks for your response, but I beg to differ. I have seen where the http object will read the output of the ASP page, not the contents. That's the whole point. I want it to read the output of the ASP page when the ASP page executes. Sometimes the http object does read the output and sometimes it does not...when it does not, it reads the source of the ASP page (as opposed to the output of the ASP page).

              Everyone please NOTE THIS: consistantly, when the http object opens the ASP page THE ASP PAGE DOES EXECUTE! No question about it. Because that is the case, I was expecting that a read of the http object would actually read the OUTPUT of the ASP page (as opposed to the contents of the ASP page). And (again) sometimes it does. Other times it reads the source of the ASP page. Interesting behaviour.

              The workaround that I have developed is that when the ASP page executes (in response to the http object doing an open), I have the ASP page write to a text file and then have a separate http object that reads the text file. The workaround seems fine but I found the inconsistant behaviour of the http object when opening an ASP page (as described above) somewhat strange.

              Scott
              Scott Masters
              www.tic2tic.com
              [email protected]

              Comment


              • #8
                Hi Scott:

                That is interesting. I use the HTTP object heavily (and have been since its inception) and I have never seen an instance where it did not retrieve the actual source of a web page (dynamic as well as static). Who knows, it may have something to do with a delay between the time the object looks for the page and the time it actually becomes available. Another issue is caching...if you browse to a page in your browser, the next time you use the HTTP object to call that same page, it will use the cached version, even (in many cases) if the actual page has changed.

                Chris

                Comment


                • #9
                  Hi Chris,

                  The way I read your response, there is a connection between opening an http object that references a web page and the browser on the users system. On my system, when I open an ASP page with an http object from my efs application, the ASP page executes (and does what I want it to), but a browser is NOT opened. For my application, this is the behavior I desire; however, based on your comments, I am concerned that in some other enviornment (e.g. on someone else's system, for whatever reason), the behavior may be different. (I do not want my efs application running on a customers system to be opening browsers!) Can you please elaborate on your experience in this regard?


                  Thanks a bunch!

                  Scott
                  Scott Masters
                  www.tic2tic.com
                  [email protected]

                  Comment

                  Working...
                  X