EXCEL端VB代碼
Dim winHttp As Object
Set winHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
With winHttp
.Open "GET", GET_CONFIG_INFO_URL, False
.setRequestHeader "CONTENT-TYPE", "application/x-www-form-urlencoded"
End With
winHttp.Send
If winHttp.Status = 200 Then
MsgBox "獲取成功" & winHttp.responseText
getConfigJson = winHttp.responseText
Else
MsgBox "獲取失敗" & winHttp.Status
End If
服務器端定義的get請求介面。
@RequestMapping(value = {"/getconfiginfo"}, method = RequestMethod.GET)
@ResponseBody
public String getconfiginfo () throws Exception{
System.out.println("getconfiginfo=====");
return "configinfo is return";
}
為什么winHttp.responseText 回傳值一直為空?“configinfo is return”接收不到?
uj5u.com熱心網友回復:
服務器端定義的get請求介面。---請問get請求介面是通過什么技術實作的?
uj5u.com熱心網友回復:
.setRequestHeader "CONTENT-TYPE", "application/x-www-form-urlencoded" 這一行先刪掉再看。這個content type是POST的時候用的,你現在的介面用的是GET。轉載請註明出處,本文鏈接:https://www.uj5u.com/net/49607.html
標籤:VB.NET
