2013-02-13 194 views
1

我必須從VB6調用REST服務。我跟着這個帖子 Get/post to RESTful web service,但不能實現太多。調用Rest服務的VB6應用程序

我迄今所做的是:

Dim sUrl As String 
Dim response As String 
Dim xmlhttp 

sUrl = "myserviceurl" 
xmlhttp = CreateObject("MSXML2.xmlhttp") 
xmlhttp.open "GET", sUrl, False 
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" 

Set xmlhttp = Nothing 

有加MSXML6我的項目引用。

我得到這個錯誤:

Object doesnt support this Method.. 
+0

字符串 「SURL」 似乎是問題給我。你可以嘗試把實際網址的路徑? – DevelopmentIsMyPassion 2013-02-13 20:23:36

+0

..它不是問題,因爲我可以調試後,以及.Sorry我不能把我的生產網址由於一些擔心。 – 2013-02-13 20:25:09

+1

你在哪一行出錯? – DevelopmentIsMyPassion 2013-02-13 20:25:54

回答

2

試試下面的代碼

Dim xmlhttp As MSXML2.XMLHTTP 
Set xmlhttp = New MSXML2.XMLHTTP 
+1

已更新工作代碼爲尋找它的人:) – 2013-02-13 21:32:58

+0

感謝哥們:) – DevelopmentIsMyPassion 2013-02-13 21:33:38

相關問題