【发布时间】:2015-12-02 07:55:45
【问题描述】:
我在 excel 中的 VBA 中将此代码用于我的宏:
Sub Macro1()
Dim URL As String, JSONString As String, objHTTP As Object
Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
URL = "xxxxx"
objHTTP.Open "POST", URL, False
objHTTP.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
JSONString = "{""name"": ""long"",""startDate"": 12345,""endDate"": 67890,""status"": ""in progress""}"
objHTTP.send JSONString
Debug.Print objHTTP.Status
Debug.Print objHTTP.responseText
End Sub
在即时窗口中,我收到了这个错误:
400 Apache Tomcat/8.0.28 - 错误 报告H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} 身体 {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} 乙 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {颜色:黑色;}A.name {颜色:黑色;}.line {高度:1px; 背景颜色:#525D76;边框:无;}
HTTP 状态 400 - 必需的字符串参数“名称”是 不存在
类型状态 报告
message 必需的字符串参数 'name' 不是 现在
描述客户端发送的请求 语法不正确。
阿帕奇 Tomcat/8.0.28
我不知道怎么解决,请帮帮我!
【问题讨论】:
-
如果你这样做会发生什么:
JSONString = "{'name':'long','startDate':12345,'endDate':67890,'status':'in progress'}"
标签: apache vba excel tomcat winhttp