ELS61 R2 FW - POST not compliant with HTTP 1.1/REST | Telit Cinterion IoT Developer Community
July 20, 2018 - 3:38pm, 8242 views
Hello Team
We have been implementing posts to REST server that always replies with response code and a response body in application/json format.
Issue is that whenever there is a body in response modem acts like there is no data, unless code was 200. Which is incorrect due to HTTP 1.1.
Due to HTTP 1.1 documentation there can be a body if response code is 201: https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
Due to REST standard there can be specification of an error in body as well. Meaning you can send response with body almost any time.
This leads to the questions :
How can we retrieve the real response code of HTTP server?
Why is the body of HTTP response not included every time to ^SISR ?
Thank you
Hello,
Could you please paste the log to show how it exactly behaves?
I see that you are probably using AT commands for this. Are you implementing a Java MIDlet or just using the external micro-controller?
Please also check the firmware version with ATI1 command.
Best regards,
Bartłomiej
Using microcontroller to send commands in format : AT....
Reading response from modem and parsing it afterwards
ATI1 returns :
Cinterion
ELS61-E
REVISION 02.000
A-REVISION 01.000.00
Failed POST : Server responds with 400 and body
-------------------------------------------------
^SYSLOADING
^SYSSTART
AT
OK
AT+CTZU=1
OK
AT+CPIN?
+CPIN: READY
OK
AT+CGDCONT=1,"IP","internet"
OK
AT+CREG=2
OK
AT+CMEE=2
OK
+PBREADY
+CREG: 5,"012F","00020124",2
AT+CGATT=1
OK
AT^SICS=0,contype,gprs0
OK
AT^SICS=0,apn,"internet"
OK
AT^SISS=2,srvtype,http
OK
+CREG: 5,"012F","00020127",2
AT^SISS=2,conid,0
OK
AT^SISS=2,hcProp,Content-Type: application/json
OK
AT^SISS=2,cmd,1
OK
AT^SISS=2,address,"https://webhook.site/00daa2be-5193-464b-9c96-b85abd7e98a7"
OK
AT^SISS=2,hccontlen,2
OK
AT^SISO=2
OK
^SIS: 2,0,2200,"Http webhook.site:443"
^SISW: 2,1
AT^SISW=2,250
^SISW: 2,250,0
OK
^SISW: 2,1
AT^SISW=2,250
^SISW: 2,250,0
OK
^SISW: 2,1
AT^SISW=2,250
^SISW: 2,250,0
OK
^SISW: 2,1
AT^SISW=2,250
^SISW: 2,250,0
OK
^SISW: 2,1
AT^SISW=2,250
^SISW: 2,250,0
OK
^SISW: 2,1
AT^SISW=2,250
^SISW: 2,250,0
OK
^SISW: 2,1
AT^SISW=2,250
^SISW: 2,250,0
OK
^SISW: 2,1
AT^SISW=2,159
^SISW: 2,159,0
OK
^SISW: 2,1
AT^SISW=2,0,1
^SISW: 2,0,0
OK
^SISW: 2,2
^SIS: 2,0,2200,"HTTP POST: https://webhook.site/00daa2be-5193-464b-9c96-b85abd7e98a7"
AT^SISC=2
OK
Success POST : server responds with 200 and body :
----
^SYSLOADING
^SYSSTART
AT
OK
AT+CTZU=1
OK
AT+CPIN?
+CPIN: READY
OK
AT+CGDCONT=1,"IP","internet"
OK
AT+CREG=2
OK
AT+CMEE=2
OK
+PBREADY
+CREG: 5,"012F","00020124",2
AT+CGATT=1
OK
AT^SICS=0,contype,gprs0
OK
AT^SICS=0,apn,"internet"
OK
AT^SISS=2,srvtype,http
OK
AT^SISS=2,conid,0
OK
AT^SISS=2,hcProp,Content-Type: application/json
OK
AT^SISS=2,cmd,1
OK
AT^SISS=2,address,"https://webhook.site/6a02cbc3-2a5e-4c2f-88a5-b60b14e91f55"
OK
AT^SISS=2,hccontlen,2
OK
AT^SISO=2
OK
^SIS: 2,0,2200,"Http webhook.site:443"
^SISW: 2,1
AT^SISW=2,250
^SISW: 2,250,0
OK
^SISW: 2,1
AT^SISW=2,250
^SISW: 2,250,0
OK
^SISW: 2,1
AT^SISW=2,250
^SISW: 2,250,0
OK
^SISW: 2,1
AT^SISW=2,250
^SISW: 2,250,0
OK
^SISW: 2,1
AT^SISW=2,250
^SISW: 2,250,0
OK
^SISW: 2,1
AT^SISW=2,250
^SISW: 2,250,0
OK
^SISW: 2,1
AT^SISW=2,250
^SISW: 2,250,0
OK
^SISW: 2,1
AT^SISW=2,159
^SISW: 2,159,0
OK
^SISW: 2,1
AT^SISW=2,0,1
^SISW: 2,0,0
OK
^SISW: 2,2
^SIS: 2,0,2200,"HTTP POST: https://webhook.site/6a02cbc3-2a5e-4c2f-88a5-b60b14e91f55"
^SIS: 2,0,2200,"HTTP POST Response: 200"
^SISR: 2,1
AT^SISR=2,0
^SISR: 2,19
OK
AT^SISR=2,19
^SISR: 2,19
{"response":"body"}
OK
^SISR: 2,2
AT^SISC=2
OK
Failed POST : Server responds with 201 and body
-------------------------------------------
^SYSLOADING
^SYSSTART
AT
OK
AT+CTZU=1
OK
AT+CPIN?
+CPIN: READY
OK
AT+CGDCONT=1,"IP","internet"
OK
AT+CREG=2
OK
AT+CMEE=2
OK
+PBREADY
+CREG: 5,"012F","00020124",2
AT+CGATT=1
OK
AT^SICS=0,contype,gprs0
OK
AT^SICS=0,apn,"internet"
OK
AT^SISS=2,srvtype,http
OK
AT^SISS=2,conid,0
OK
AT^SISS=2,hcProp,Content-Type: application/json
OK
AT^SISS=2,cmd,1
OK
AT^SISS=2,address,"https://webhook.site/5c3085f3-2700-4127-bf02-7e159331d5f3"
OK
AT^SISS=2,hccontlen,2
OK
AT^SISO=2
OK
^SIS: 2,0,2200,"Http gateway-test.ambrosus.com:443"
^SISW: 2,1
AT^SISW=2,250
^SISW: 2,250,0
OK
^SISW: 2,1
AT^SISW=2,250
^SISW: 2,250,0
OK
^SISW: 2,1
AT^SISW=2,250
^SISW: 2,250,0
OK
^SISW: 2,1
AT^SISW=2,250
^SISW: 2,250,0
OK
^SISW: 2,1
AT^SISW=2,250
^SISW: 2,250,0
OK
^SISW: 2,1
AT^SISW=2,250
^SISW: 2,250,0
OK
^SISW: 2,1
AT^SISW=2,250
^SISW: 2,250,0
OK
^SISW: 2,1
AT^SISW=2,159
^SISW: 2,159,0
OK
^SISW: 2,1
AT^SISW=2,0,1
^SISW: 2,0,0
OK
^SISW: 2,2
^SIS: 2,0,2200,"HTTP POST: https://webhook.site/5c3085f3-2700-4127-bf02-7e159331d5f3"
AT^SISC=2
OK
just to clarify if e set server to respond only with 200
we receive simmilar thing as in documentation, page 291 part 10.15.17 HTTP Post
....
^SIS: 6,0,2200,"HTTP POST: http://testnetwork/cgi/first.pl"
6,0,2200,"HTTP POST Response: 200"
^SISR: 6,1
AT^SISC=6
The issue starts if Post server responds with any other response code than 200 and/or data are present
Tested the same with GET
On success code body is present in ^SISR
If we try 400 or any other errro no ^SISR is provided
as for the GET which not our main issue but misbehaves on modem FW
AT commands are missing but the process is the same as in POST, it is just printed from console of IDE
Failed GET : response with 400 and body :
-----------------------------------------
<info> app: Modem ON
<info> app: AT callback: ^SYSLOADING
<info> app: sysloading MATCH
<info> app: AT callback: ^SYSSTART
<info> app: sysstart MATCH
<info> app: AT callback:
OK
<info> app: AT callback: +CTZU=1
<info> app: AT callback: OK
<info> app: AT callback: +CPIN?
<info> app: AT callback: +CPIN: READY
OK
<info> app: AT callback: +CGDCONT=1,"IP","internet"
<info> app: AT callback: OK
<info> app: creg OK
<info> app: AT callback: OK
<info> app: AT callback: +CMEE=2
<info> app: AT callback: OK
<info> app: AT callback: +PBREADY
<info> app: pbready event
<info> app: creg +CREG: 5,"012F","00020127",2
<info> app: Modem connection settle timeout
<info> app: CONNECTED
<info> app: AT callback: +CGATT=1
<info> app: AT callback: OK
<info> app: AT callback: ^SICS=0,contype,gprs0
<info> app: AT callback: OK
<info> app: AT callback: ^SICS=0,apn,"internet"
<info> app: AT callback: OK
<info> app: AT callback: ^SISS=2,srvtype,http
<info> app: AT callback: OK
<info> app: AT callback: ^SISS=2,conid,0
<info> app: AT callback: OK
<info> app: AT callback: ^SISS=2,hcProp,Content-Type: application/json
<info> app: AT callback: OK
<info> app: AT callback: ^SISS=2,cmd,0
<info> app: AT callback: OK
<info> app: AT callback: ^SISS=2,address,"https://webhook.site/817ecf7a-c08f-4562-8d60-6dc449f1548e"
<info> app: AT callback: OK
<info> app: AT callback: ^SISS=2,hccontlen,2
<info> app: AT callback: OK
<info> app: AT callback: ^SISO=2
<info> app: AT callback: OK
^SIS: 2,0,2200,"Http webhook.site:443"
<info> app: sis: ^SIS: 2,0,2200,"Http webhook.site:443"
<info> app: AT callback: ^SIS: 2,0,202,"HTTP-ERR: response: 400"
<info> app: sis: ^SIS: 2,0,202,"HTTP-ERR: response: 400"
Successful GET : Response with 200 and body
--------------------------------------------
<info> app: ^SYSLOADING
<info> app: ^SYSSTART
<info> app: OK
<info> app: +CTZU=1
<info> app: OK
<info> app: +CPIN?
<info> app: +CPIN: READY
OK
<info> app: +CGDCONT=1,"IP","internet"
<info> app: OK
<info> app: creg OK
<info> app: OK
<info> app: +CMEE=2
<info> app: OK
<info> app: +PBREADY
<info> app: creg +CREG: 5,"012F","00020127",2
<info> app: Modem connection settle timeout
<info> app: CONNECTED
<info> app: +CGATT=1
<info> app: OK
<info> app: ^SICS=0,contype,gprs0
<info> app: OK
<info> app: ^SICS=0,apn,"internet"
<info> app: OK
<info> app: ^SISS=2,srvtype,http
<info> app: OK
<info> app: ^SISS=2,conid,0
<info> app: OK
<info> app: ^SISS=2,hcProp,Content-Type: application/json
<info> app: OK
<info> app: ^SISS=2,cmd,0
<info> app: OK
<info> app: ^SISS=2,address,"https://webhook.site/cbadec67-3196-4830-9ea0-ac8267d1e537"
<info> app: OK
<info> app: ^SISO=2
<info> app: OK
^SIS: 2,0,2200,"Http webhook.site:443"
<info> app: ^SISR: 2,1
<info> app: ^SISR=2,24
<info> app: ^SISR: 2,24
{"response":"some body"}
OK
Pages