Responsethttpx error

Hi,
Ewon Type: Flexy (FLEXY10100_00)

I am trying to post a log file to a remote server and retrieve the response but I receive a 32603 error. The file is successfully received by the server and a 200 OK response is sent but the Flexy still shows the 32603 error.

In the event logs I see the following errors:
21304: eftp-Invalid Source
28604: secu-The file the user is trying to write is unknown
32603: httpc-http request error

I am not making use of any VPN, eSync or data mailbox.
I get the same error when posting to the server using HTTPS and when posting to a test server on the local network using HTTP

Below is my code to post the data using the BASIC IDE:

FUNCTION GetCurrentTimeStamp$()
$EWON_TIME$ = TIME$
$GetCurrentTimeStamp$ = $EWON_TIME$(1 To 2) + $EWON_TIME$(4 To 5) + $EWON_TIME$(7 To 10) + “_” + $EWON_TIME$(12 To 13) + $EWON_TIME$(15 To 16) + $EWON_TIME$(18 To 19)
ENDFN

lastTime$ = @GetCurrentTimeStamp$()
fileName$ = “historic_data_” + lastTime$ + “.csv”

MakeRequest:
REQUESTHTTPX “https://[my_remote_server]/upload”,“POST”,“authorization=1234”,"",“file_upload=[$dtHT $fn”+fileName$+"]",“POSTERROR”
//REQUESTHTTPX “http://[my_local_server]:5000/upload”,“POST”,“authorization=1234”,"",“file_upload=[$dtHT $fn”+fileName$+"]",“POSTERROR”

ONSTATUS "GOTO Response" 

END

Response:
actionId% = GETSYS PRG, “ACTIONID”
eventId% = GETSYS PRG, “EVTINFO”
PRINT "Action ID: "; actionId%
PRINT "Event ID: "; eventId%
IF eventId% = actionId% THEN
currentState% = GETSYS PRG, “ACTIONSTAT”
PRINT "Current State: "; currentState%
IF currentState% = 0 THEN
body$ = RESPONSEHTTPX “RESPONSE-BODY”
PRINT body$
ELSE
PRINT "Error: "; currentState%
ENDIF
ENDIF

END

How can retrieve the correct response from the server?

Hello,

Is the server seeing anything POSTed? It looks like this issue is related to the file you are trying to post. does the EBD work when used direcly with the ewon?

Deryck

Hi Deryck,

Yes, the full file is received on the server and the filename is also received correctly according to the EBD.

This might be an error unrelated to the request, does it show up everytime the request is made? It could also be an error with how the file is being generated with the EBD.

If you write the requesthttpx response to a file does this show any further details in the response back?

Deryck

I found the problem. The S6 parameter should be the file answer and not error code. I changed my request from

“https://[my_remote_server]/upload”,“POST”,“authorization=1234”,"",“file_upload=[$dtHT $fn”+fileName$+"]",“POSTERROR”

to

“https://[my_remote_server]/upload”,“POST”,“authorization=1234”,"",“file_upload=[$dtHT $fn”+fileName$+"]","/usr/httpreq_resp.txt"

After making the change I was able to interpret the server response using responsehttpx.

Ah that would do it. Thanks for following up.

Deryck