[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>
Scott,
The following is what I see when debugging into HTTPAPIR4
*** After the callback procedure is called in my sample application,
the following occurs in HTTPAPIR4 (http_url_post_raw)
***While dedebugging the http_url_post_raw, wwData was
***filled with valid data after callback occured. rc=611 (which is valid
byte count)
***Everything is OK in the following lines of code.
2057 216200 C* Write any data received to the save procedure.
2058 216300 c eval rc = saveproc(peFD:
%addr(wwData)
2059 216400 c if rc < wwLen
2060 216500 c callp SetError(HTTP_RDWERR:'recvdoc:
sa
2061 216600 c ' Not all data was written!')
2062 216700 c return -1
2063 216800 c endif
2064 216900
** Then it trys to receive as much data but it already has the data, then
wwLen is set to -1
** but wwData is still filled with good data
2005 210900
2006 211000 C* receive as much data as is available & will fit in our buffe
2007 211100 c eval wwLen = recv(peSock: %addr(wwData
2008 211200 c %size(wwData): 0)
**** Must be my .Net WEB service is not sending some bit of info that
HTTPAPIR4 is looking for.
**** However, it is working fine on Scott's AS400 ?????????
-----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
-----------------------------------------------------------------------