[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

HTTPAPI and CGIDEV2...



   Hi all, for a little background of what I'm trying to accomplish here
   is the original thread from the RPG400 mailing list which got me
   pointed to HTTPAPI thanks to Sean Porterfield\s suggestion.
   Mass testing a URL
   Hi all,
   I can't figure out how to call a URL multiple times for testing.  Here
   is the scenario.
   We have an existing program (RPGLE, CGIDEV2) which is a called by the
   following URL
   ([1]http://mycompany.com/weblibp/ut1500.pgm?action=start&storea=197&re
   questa=00073135115015).  When called the program creates an xml
   document in the browser.
   I created a stored procedure to replace the program.  The stored
   procedure now returns a resultset instead of an xml document.
   In order parallel test the new sp against the old program I modified
   both the output to test result files which can be compared against
   each other.
   So I now wish to create a program which reads an input file
   (containing the tests I wish to perform) and for each row call the
   stored procedure and then the URL (substituting in the store and the
   request parameters).
   At this point Sean Porterfield suggested I could use HTTPAPI.
   So I modified my program to use http_url_post like so:
         /free
           *inlr = *on;
           data = *blanks;
           location  = '[2]http://mycompany.com/weblibp/ut1500.pgm';
           action    = '?action=start';
           // hardcode the value for now
           p_store   = 72;
           p_reqtype = '00000000002521';
           store    = '&storea=' + %Editc(%Dec(p_store: 3: 0): 'X');
           request  = '&requesta=' + %Trim(p_reqtype);
           url       = location + action + store + request;
           rc        = http_url_post( url
                                    : %addr(data)
                                    : %len(%trimr(data))
                                    : '/tmp/httptest.html'
                                    : 1);
           If rc <> 1;
             msg = http_error;
             dsply msg;
             Return;
           Endif;
           return;
         /End-free
   Eveything nothings seems to err (except the timeout but that's
   expected).
   The CGI program UT1500 is being called as I put a SEP on it and
   confirmed that it is running.  The problem is that the querystring it
   attempts to read is blank.
   If I paste the contents of variable url (in the above program) into a
   browser's address it works fine and the query string is populated.
   Is there something wrong in my call to http_url_post or should I be
   using something else?
   Can I even do what I'm trying?
   Thanks,
   Robert Rogerson

References

   1. http://mycompany.com/weblibp/ut1500.pgm?action=start&storea=197&requesta=00073135115015
   2. http://mycompany.com/weblibp/ut1500.pgm
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------