HTTP testing with Simcom SIM7070, SIM7080 Modules
Steps to test HTTP GET with SIM7070, SIM7080 Modules
- Verify that the device is registered with the network provider
- Query the network using the AT+CGNAPN command
- Activate the network bearer using the AT+CNACT command and verify that the activated bearer profile has IP addressed using the AT+CNACT? command.
- Set up the HTTP parameters using the AT+SHCONF command
- Set up the HTTP head using the AT+SHAHEAD command
- For HTTP PUT requests, setup the URL parameters with the AT+SHPARA command
- For HTTP POST requests, setup the POST data with AT+SHBOD command
- Send the HTTP GET/PUT/POST request using the AT+SHREQ command
- Read the HTTP response using the AT+SHREAD command
HTTP GET
Use the AT Command Tester tool to test the HTTP Get feature with the SIM7070/SIM7080 modules.
HTTP GET SCRIPT MODE
HTTP GET function can be tested with script mode in the AT Command Tester tool.
Try the script in AT Command Tester tool.
//Script: HTTP GET testing with Simcom SIM7070, SIM7080 modules //The AT commands in this script are applicable for Simcom modules only //Check SIMCOM Module AT Command documentation //Get the support for the commands AT+SHREQ=? //Wait WAIT=1 //Get the current request AT+SHREQ? //Wait WAIT=1 //Activate the network bearer AT+CNACT=0,1 //Wait WAIT=1 //Set up the HTTP URL AT+SHCONF="URL","http://www.httpbin.org" //Wait WAIT=1 //HTTP body length AT+SHCONF="BODYLEN",1024 //HTTP head length AT+SHCONF="HEADERLEN",350 //HTTP connection AT+SHCONN //Wait WAIT=1 //Get the connection status AT+SHSTATE? //Wait WAIT=1 //Make the HTTP request AT+SHREQ="http://www.httpbin.org/get",1 //Wait WAIT=10 //Read the HTTP response AT+SHREAD=0,391 //Wait WAIT=3 //Disconnect HTTP AT+SHDISC
Output of the script in the AT Command Tester tool.
AT+SHREQ=? +SHREQ: 512,(1-5) OK AT+SHREQ? +SHREQ: http://www.httpbin.org/get,1 OK AT+CNACT=0,1 ERROR AT+SHCONF="URL","http://www.httpbin.org" OK AT+SHCONF="BODYLEN",1024 OK AT+SHCONF="HEADERLEN",350 OK AT+SHCONN OK AT+SHSTATE? +SHSTATE: 1 OK AT+SHREQ="http://www.httpbin.org/get",1 OK +SHREQ: "GET",200,391 AT+SHREAD=0,391 OK +SHREAD: 391 { "args": {}, "headers": { "Accept": "text/html, */*", "Cache-Control": "no-cache", "Content-Length": "0", "Content-Type": "application/x-www-form-urlencoded", "Host": "www.httpbin.org", "User-Agent": "IOE Client", "X-Amzn-Trace-Id": "Root=1-5ecbd50d-9ad830a62424f62bbe37601e" }, "origin": "52.38.67.254", "url": "http://www.httpbin.org/get" } AT+SHDISC OK
HTTP PUT SCRIPT MODE
HTTP PUT function can be tested with script mode in the AT Command Tester tool.
Try the script in AT Command Tester tool.
//Script: HTTP PUT testing with Simcom SIM7070, SIM7080 modules //The AT commands in this script are applicable for Simcom modules only //Check SIMCOM Module AT Command documentation //Query the network AT+CGNAPN //Wait WAIT=1 //Activate the network bearer AT+CNACT=0,1 //Get the current request AT+SHREQ? //Wait WAIT=1 //Set up the HTTP URL AT+SHCONF="URL","http://www.httpbin.org" //Wait WAIT=1 //HTTP body length AT+SHCONF="BODYLEN",1024 //HTTP head length AT+SHCONF="HEADERLEN",350 //HTTP connection AT+SHCONN //Wait WAIT=1 //Get the connection status AT+SHSTATE? //Wait WAIT=1 //Clear the HTTP header AT+SHCHEAD //Wait WAIT=1 //Add header content AT+SHAHEAD="Accept","text/html, */*" //Wait WAIT=1 //Add header content AT+SHAHEAD="User-Agent","IOE Client" //Wait WAIT=1 //Add header content AT+SHAHEAD="Content-Type","application/x-www-form-urlencoded" //Wait WAIT=1 //Add header content AT+SHAHEAD="Connection","keep-alive" //Wait WAIT=1 //Add header content AT+SHAHEAD="Cache-control","no-cache" //Setup HTTP parameter AT+SHPARA="parm1","data1" //Setup HTTP parameter AT+SHPARA="parm2","data2" //Make the HTTP request AT+SHREQ="http://www.httpbin.org/put",2 //Wait WAIT=5 //Disconnect HTTP AT+SHDISC
Output of the script in the AT Command Tester tool.
AT+CGNAPN +CGNAPN: 1,"soracom.io" OK AT+CNACT=0,1 ERROR AT+SHREQ? +SHREQ: http://www.httpbin.org/put,2 OK AT+SHCONF="URL","http://www.httpbin.org" OK AT+SHCONF="BODYLEN",1024 OK AT+SHCONF="HEADERLEN",350 OK AT+SHCONN OK AT+SHSTATE? +SHSTATE: 1 OK AT+SHCHEAD OK AT+SHAHEAD="Accept","text/html, */*" OK AT+SHAHEAD="User-Agent","IOE Client" OK AT+SHAHEAD="Content-Type","application/x-www-form-urlencoded" OK AT+SHAHEAD="Connection","keep-alive" OK AT+SHAHEAD="Cache-control","no-cache" OK AT+SHPARA="parm1","data1" OK AT+SHPARA="parm2","data2" OK AT+SHREQ="http://www.httpbin.org/put",2 OK +SHREQ: "PUT",200,503 AT+SHDISC OK
HTTP POST
HTTP POST function can be tested in the AT Command Tester tool.
HTTP POST SCRIPT MODE
HTTP POST function can be tested with script mode in the AT Command Tester tool.
Try the script in AT Command Tester tool.
//Script: HTTP POST testing with Simcom SIM7070, SIM7080 modules //The AT commands in this script are applicable for Simcom modules only //Check SIMCOM Module AT Command documentation //Query the network AT+CGNAPN //Wait WAIT=1 //Activate the network bearer AT+CNACT=0,1 //Get the current request AT+SHREQ? //Wait WAIT=1 //Set up the HTTP URL AT+SHCONF="URL","http://www.httpbin.org" //Wait WAIT=1 //HTTP body length AT+SHCONF="BODYLEN",1024 //HTTP head length AT+SHCONF="HEADERLEN",350 //HTTP connection AT+SHCONN //Wait WAIT=1 //Get the connection status AT+SHSTATE? //Wait WAIT=1 //Clear the HTTP header AT+SHCHEAD //Wait WAIT=1 //Add header content AT+SHAHEAD="Accept","text/html, */*" //Wait WAIT=1 //Add header content AT+SHAHEAD="User-Agent","IOE Client" //Wait WAIT=1 //Add header content AT+SHAHEAD="Content-Type","application/x-www-form-urlencoded" //Wait WAIT=1 //Add header content AT+SHAHEAD="Connection","keep-alive" //Wait WAIT=1 //Add header content AT+SHAHEAD="Cache-control","no-cache" //Setup POST data AT+SHBOD=23,10000 //Wait WAIT=1 //Send the form data parm1=data1&parm2=data2 //Make the HTTP POST request AT+SHREQ="http://www.httpbin.org/post",3 //Wait WAIT=7 //Disconnect HTTP AT+SHDISC
Output of the script in the AT Command Tester tool.
Sending AT query.. AT OK Successfull response for AT query.. Enabling echo and verbose mode ATE1V1 OK AT+CGMM SIMCOM_SIM7080G OK Model Number : SIMCOM_SIM7080G AT+CGMI SIMCOM_Ltd OK Manufacturer : SIMCOM_Ltd AT+CGNAPN +CGNAPN: 1,"soracom.io" OK AT+CNACT=0,1 ERROR AT+SHREQ? +SHREQ: http://www.httpbin.org/put,3 OK AT+SHCONF="URL","http://www.httpbin.org" OK AT+SHCONF="BODYLEN",1024 OK AT+SHCONF="HEADERLEN",350 OK AT+SHCONN OK AT+SHSTATE? +SHSTATE: 1 OK AT+SHCHEAD OK AT+SHAHEAD="Accept","text/html, */*" OK AT+SHAHEAD="User-Agent","IOE Client" OK AT+SHAHEAD="Content-Type","application/x-www-form-urlencoded" OK AT+SHAHEAD="Connection","keep-alive" OK AT+SHAHEAD="Cache-control","no-cache" OK AT+SHBOD=23,10000 > parm1=data1&parm2=data2 OK AT+SHREQ="http://www.httpbin.org/post",3 OK +SHREQ: "POST",200,504 AT+SHDISC OKKeywords: Module , M2M , GPRS , 3G , through AT commands,