I’m using an AS 6.5 http client making RESTful calls to a backend. I’m having a problem when calling an api endpoint as GET method with no parameters and no body. Using Postman I have no erros so I’m sure the backend api is working properly. This endpoint is used to check connection between the PLC and the webserver. It returns a small JSON body containing the server time in epoch. The illustration includes the header configuration for the http request. My problem: the httpClient.tcpStatus returns 32609.
Any ideas why this error occurs? Any help will be very much appreciated.
Hi,
no concrete idea right now.
The error 32609 comes from the TCP stack where AsHttp is operating on.
I think I saw such behavior in past when using TCP, and the remote partner closed the TCP channel as long as my code still tried to send data.
Could be some timing issue maybe.
-
Could you please trace the .phase output of HttpClient() call so that we can see if something was executed with HttpClient() before it ended up in that result?
-
In what cycle time you’re calling the function block? If it’s a slow one, please try to run it faster to check if something changes.
-
Last but not least, you could try to set the HTTP connection to “keep-alive”, with some short keep-alive timing, e.g. “timeout=2, max=10” (and let the client close the channel by .enable = 0 after a response, if you get one)
If the cause is timing based, I think by doing those tests we should see some change in the behavior, and should get some more information in what direction we can investigate deeper.
Best regards!
Thank you Alaxander for your reply. I have discovered what I believe is an anomoly with B&R’s httpClient. Here are my findings:
Request with body (JSON)
- RequestHeader.Connection can be either ‘close’ or ‘keep-alive’ with successful response.
- Content-Type = application/json
- Content-Length = {body length}
Request without body (with or without parameters):
- RequestHeader.Connectioin must be ‘keep-alive’ for successful response.
- httpClient.tcpStatus = 32609 occurs if RequestHeader.Connection = ‘close’
- This is the case regardless if Content-Type or Content-Length are included in the request header.
This issue has now been resolved. Thank you!
BR,
Jason