我刚刚开始使用Quectel MC60,我遇到了一些问题:
关于HTTP GET方法,我发出以下命令:
<?xml version="1.0" encoding="UTF-8"?>{% from lxml import etree %}{% from StringIO import StringIO %}{% set tree = parse_xml(request_text) %}{% set namespaces = {'soapenv': 'http://schemas.xmlsoap.org/soap/envelope/', 'wbs': 'http://xml.ama.com/ws/2009/01/WBS_Session-2.0.xsd'}%}<soap:Envelope xmlns:xalan="http://xml.apache.org/xalan" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><Session><SessionId>{{tree.xpath('//soapenv:Header/wbs:Session/wbs:SessionId', namespaces=namespaces)[0].text}}</SessionId><SequenceNumber>{{int(tree.xpath('//soapenv:Header/wbs:Session/wbs:SequenceNumber', namespaces=namespaces)[0].text)+1}}</SequenceNumber><SecurityToken>{{tree.xpath('//soapenv:Header/wbs:Session/wbs:SecurityToken', namespaces=namespaces)[0].text}}</SecurityToken></Session></soap:Header><soap:Body><reRoot><reNode> world</reNode></reRoot></soap:Body></soap:Envelope>
使用QCOM软件时,我会按顺序运行上述所有命令。当谈到AT + QHTTPREAD命令时,响应总是“+ CME ERROR:3822”(HTTP响应失败)。它能是什么?我确定HTTP服务器工作正常。
答案 0 :(得分:1)
答案是有必要配置请求标头
AT+QIFGCNT=0
AT+QICSGP=1,"my_apn"
AT+QIREGAPP
AT+QIACT
AT+QHTTPURL=39,40
my_url_39_bytes_long
AT+QHTTPCFG="requestheader",1
AT+QHTTPPOST=77
GET path HTTP/1.1
User-Agent: Fiddler
Host: www.my_host.com
AT+QHTTPREAD=30
AT+QIDEACT
注意:在AT+HTTPPOST=77
中,77是POST消息的大小(最后两个\ r \ n是必需的并且是计数)
NOTE2 :GET之后,您应该写入AT+QHTTPURL
中插入的网址的路径。例如,如果您将网址指定为https://www.my_host.com/debug/main/port
,那么您的AT+HTTPPOST
请求应如下所示(请勿忘记最后两个\ r \ n):
GET /debug/main/port HTTP/1.1
User-Agent: Fiddler
Host: www.my_host.com