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

Re: http_url_post_stmf



   Maybe you could split the part that does this download into a separate
   job, and submit it with the SBMJOB command?  That would be the easiest.
   HTTPAPI does require it's code to do things during the download, so you
   cannot just "not wait" for it to finish, since it's code has to be
   running.   Submitting it to batch would be an easy solution.   Spawning
   a child job would, similarly, work.
   A much more complicated solution might be to make your program
   multi-threaded.   However, HTTPAPI has not been tested in a
   multi-threaded scenario, so it may require changes....  it would be
   very tricky.   And a multi-threaded program cannot run in an
   interactive session, anyway...  so, not sure if this would really help
   you.
   -SK

   On 2/10/2014 7:31 AM, [1]Venter.Derick@xxxxxxxxxxxxxx wrote:

   Hi
   Hope you can help me.
   I have a url that i want to execute, but do not want to wait for it to
   complete. The url will create a pdf report in a folder somewhere and my
   program doesn't need to wait for it to complete.
   How can i tell it to run in the background or not to wait for a URL
   post/ get to complete?
   Here is my code:
   rc = http_url_post_stmf('[2]http://p6devc01:8050/p6rpt/TestCerts/'
                                    + 'TestCertPublishPlx.aspx?'
                                    + 'REPORT=TESTCERTPUBLISH&'
                                    + 'PARAMETER1=20263&'
                                    + 'PARAMETER2=1&PARAMETER3=TUVEXT'
                                    : '/tmp/httptest.txt'
                                    : '/tmp/httptest1.html'
                                    : HTTP_TIMEOUT
                                    : HTTP_USERAGENT
                                    : ContentType );
                if rc=302;
                   vServiceURL = http_redir_loc();
                   rc = http_url_post_stmf(vServiceURL
                                    : '/tmp/httptest.txt'
                                    : '/tmp/httptest1.html'
                                    : HTTP_TIMEOUT
                                    : HTTP_USERAGENT
                                    : ContentType );
                    PrintMe = %TRIM(vServiceURL);
                    Except Print;
                   //rc = http_url_get( url . . .  );
                endif;
   Regards
   Derick Venter
   Applications Developer IV

   [[3]cid:_4_09F5198C09F5158C004A541142257C7B]

   Systems Integration
   Tel: +27 (13) 247 2816 Fax: +27 (0) 86 573 2274
   Cell: +27 (0) 83 458 6599
   Email: [[4]1]derick.venter@xxxxxxxxxx
   [2]www.gijima.com
   From:        Ceriani Matteo [5]<m.ceriani@xxxxxxxxx>
   To:        HTTPAPI and FTPAPI Projects [6]<ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
   Date:        2013/12/19 12:28 PM
   Subject:        RE: Error using  http_url_get
   Sent by:        [7]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
     __________________________________________________________________

   Hello Scott and Sean,
   My version of  HTTPAPI is 1.23 released 2008-04-24 OS/400 Ver V6R1M0
   Is It old?
   I've activated the debug and I stressed the program:
   http_debug(*on:'/PUMART/dbg_purtsrcpgm.txt');
   When I go to launch the program and It goes wrong, this is not written
   to me debugging and it seemed very strange.
   So I went out of program and I did wrklnk '/PUMA*' and I take this CPF:

   CPFA0A4  (Error CPFA0A4.Too many open files for process.)
   At first on my session I've done wrkjob --> opz. 14
   But there isn't open file.
   So I ask to google help me!
   I've read a post with the same problem and i find the problem.
   In a program I do the open on my ifs .txt but i didn't close, beacause
   I was used a return instead of a leave...
   So I saturate open files my job, inizially I was though that should be
   a socket problem because I was misled variable error msg that was
   enhanced with "() Socket: Too many open files".
   Thank's to all availability.
   Merry Christmas and Happy New Year
   MC


   -----Original Message-----
   From: [8]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   [[3][9]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott
   Klement
   Sent: giovedì 19 dicembre 2013 00:13
   To: HTTPAPI and FTPAPI Projects
   Subject: Re: Error using http_url_get
   Hello Matteo,
   For some reason, you are getting an error when you try to create a
   socket.  A socket is a tool used to read/write data to a network. (A
   socket is similar to a file, except a file is for reading/writing data
   to a hard drive, and a socket is for reading/writing data to a program
   over a network.)
   All error 4 means is that the system refused to create a socket.  To
   learn more about what has failed, please send us a debug/trace file.
   To do that, add http_debug(*on) into your code before you call any
   HTTPAPI routines. This will generate the trace file in an IFS file
   named
   /tmp/httpapi_debug.txt.   Please send a copy of that file to this
   mailing list -- it will tell us what error is occurring in opening a
   socket.
   -SK
   On 12/18/2013 2:14 AM, Ceriani Matteo wrote:
   >     Hi Scott,
   >
   >
   >
   >     I try to use rc = http_url_get(URL: link); and it works well, but
   after
   >     many time that I use it in interactive procedure, I obtain -1
   return
   >     value and using: http_error(err);
   >
   >     Err is value with "ERR = 4" and reading unix documentation I've
   >     understood that should be a problem on the open socket... is
   there a
   >     way to close then?
   >
   >     if i do on my system "ulimit -aH" i've for  unlimited    and if I
   do
   >     "ulimit -aS" I've 200 for open file/item.
   >
   >     thk's in advance.
   >
   >     Matteo
   >
   >
   >
   >     my code:
   >
   >
   >
   >     http_debug(*off:'/PUMART/dbg.txt');
   >
   >              rc = http_url_get(URL: link);
   >
   >              if rc = 302;
   >
   >                 url = http_redir_loc;
   >
   >                 rc = http_url_get(URL: link);
   >
   >              endif;
   >
   >              if rc <> 1 ;
   >
   >                 http_error(err);
   >
   >                 if err <> HTTP_NDAUTH;
   >
   >                    http_debug(*on:'/PUMART/dbg.txt');
   >
   >                    msg = HTTP_ERROR;
   >
   >                    return *on;
   >
   >                 endif;
   >
   >                 rc = http_getauth(basic: digest: realm) ;
   >
   >                 if rc < 0;
   >
   >                    msg = HTTP_ERROR ;
   >
   >                    return *on;
   >
   >                 endif ;
   >
   >                 userid = 'xxx';
   >
   >                 pass = 'xxx' ;
   >
   >                 if  Digest   ;
   >
   >                     http_setauth(HTTP_AUTH_MD5_DIGEST:
   >
   >                                          userid: pass);
   >
   >                 else;
   >
   >                      http_setauth(HTTP_AUTH_BASIC:
   >
   >                                           userid: pass);
   >
   >                endif ;
   >
   >                rc = http_url_get(URL: link);
   >
   >                if rc = 302;
   >
   >                   url = http_redir_loc;
   >
   >                   rc = http_url_get(URL: link);
   >
   >                endif;
   >
   >                IF  rc <> 1;
   >
   >                    http_debug(*on:'/PUMART/dbg.txt');
   >
   >                    eval      msg = HTTP_ERROR;
   >
   >                    return *on;
   >
   >                endif;
   >
   >              endif;
   >
   >
   >
   >
   ----------------------------------------------------------------------
   > - This is the FTPAPI mailing list.  To unsubscribe, please go to:
   > [4][10]http://www.scottklement.com/mailman/listinfo/ftpapi
   >
   ----------------------------------------------------------------------
   > -
   -----------------------------------------------------------------------
   This is the FTPAPI mailing list.  To unsubscribe, please go to:
   [5][11]http://www.scottklement.com/mailman/listinfo/ftpapi
   -----------------------------------------------------------------------
     __________________________________________________________________

   This e-mail is subject to the Columbus Stainless [Pty] Ltd Email Legal
   Notices available at:
   [6][12]http://www.columbus.co.za/EmailLegalNotice.htm.
     __________________________________________________________________

   This e-mail message has been scanned for Viruses and Content and
   cleared by MailMarshal
     __________________________________________________________________

References

   1. [13]mailto:derick.venter@xxxxxxxxxx
   2. [14]http://www.gijima.com/
   3. [15]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   4. [16]http://www.scottklement.com/mailman/listinfo/ftpapi
   5. [17]http://www.scottklement.com/mailman/listinfo/ftpapi
   6. [18]http://www.columbus.co.za/EmailLegalNotice.htm


-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
[19]http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------

References

   1. mailto:Venter.Derick@xxxxxxxxxxxxxx
   2. http://p6devc01:8050/p6rpt/TestCerts/
   3. cid:_4_09F5198C09F5158C004A541142257C7B
   4. mailto:1]derick.venter@xxxxxxxxxx
   5. mailto:m.ceriani@xxxxxxxxx
   6. mailto:ftpapi@xxxxxxxxxxxxxxxxxxxxxx
   7. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   8. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   9. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
  10. http://www.scottklement.com/mailman/listinfo/ftpapi
  11. http://www.scottklement.com/mailman/listinfo/ftpapi
  12. http://www.columbus.co.za/EmailLegalNotice.htm
  13. mailto:derick.venter@xxxxxxxxxx
  14. http://www.gijima.com/
  15. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
  16. http://www.scottklement.com/mailman/listinfo/ftpapi
  17. http://www.scottklement.com/mailman/listinfo/ftpapi
  18. http://www.columbus.co.za/EmailLegalNotice.htm
  19. http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------