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

RE: http_url_post_raw api does not think it received valid data when it really did



Sender: "Tom Carriere" <carriere@xxxxxxx>

I guess the timeout part of the api does not work
on my AS400 V4R4M0

If I set it to 2, 20 or 60 seconds, the application sleeps until
the timeout has elapsed and I always receive good valid returned data.

The problem is that the timeout is behaving like
a sleep or delay and this is not
the way the api was intended to work.

For some reason the http_post_raw api does not think that
it received valid data when I debug it.  I am not sure why
it does not think that it has received valid data.  

Should
I turn the DHTTP_DEBUG_FILE define on and send you the results?


-----Original Message-----
From: owner-ftpapi@xxxxxxxxxxxxx [mailto:owner-ftpapi@xxxxxxxxxxxxx]On
Behalf Of Scott Klement
Sent: Monday, March 01, 2004 5:46 PM
To: ftpapi@xxxxxxxxxxxxx
Subject: RE: http_url_post_raw api does not think it received valid data
when it really did


Sender: Scott Klement <klemscot@xxxxxxxxxxxx>


>
> They were checking for return code to not be 1 indicating that
> this is an error.  Can you confirm
> that RC=1 is good return code and what would a bad RC be?

RC = -1 means that an error was encountered by HTTPAPI.
RC = 0  means that the time-out period has elapsed
RC = 1  means that the communication was successful
RC > 1  means that the HTTP server returned an error. RC will
         contain the numeric HTTP error code.

When I tried your example, I received "RC=1" which means that the
communication was successful.

>
> I am using timeout to 1 second.  What do you recommend
> and when does the timeout come in to play?
>

Whenever HTTPAPI is waiting for the remote server.  If no data can be sent
to the server, or received from the server (depending on what it's doing)
within the timeout period, it will give up and send an error.

So, if you specify 1 second, then if there's 1 second where it can't
either send 1 byte to the server, or receive 1 byte from the server, it
will exit.

Sometimes there are lags on the Internet that you'll want to wait for.
Maybe a packet needs to be re-sent, etc.   That's why the default timeout
value is set to 60 seconds... However, if you're running on a LAN, or a
wait is unacceptable, you can override this setting.

Here's an example of using the default timeout & user-agent, but
specifying your own custom content-type, and then checking for error:

C                   eval      rc = http_url_post_raw(
C                             'http://transport.alk.com/'
C                              'Fleetsuite.asmx/GetDirFromAdrToAdr?'
C                               : %addr(data): %len(%trimr(data))
C                               : 1
C                               : %paddr('INCOMING')
C                               : HTTP_TIMEOUT
C                               : HTTP_USERAGENT
C                               : 'application/x-www-form-urlencoded')
 *
C                   if        rc <> 1
C                   eval      msg = http_error
C                   dsply                   msg
c                   endif

The constants "HTTP_TIMEOUT" and "HTTP_USERAGENT" are in CONFIG_H which is
automatically included when you include HTTPAPI_H.


-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------