1

我是编码的初学者。

我必须调用下面的网络服务: http ://www.w3schools.com/webservices/tempconvert.asmx?op=CelsiusToFahrenheit

输入像 25 这样的值,然后单击 Invoke 会返回华氏温度。

为此,我使用了以下代码:

url = "http://www.w3schools.com/webservices/tempconvert.asmx?op=CelsiusToFahrenheit&Celsius=25"
'Set oHttpReq = CreateObject("Microsoft.XMLHTTP") 'when i use XMLHTTP i am getting error saying "The download of the specified resource has failed."

Set oHttpReq = CreateObject("MSXML2.ServerXMLHTTP") 'If i use it, the response contains Root Element missing

oHttpReq.open "POST", url, False
oHttpReq.send

'Response
responseText = oHttpReq.responseText 

WScript.echo responseText

谁能帮我?

4

1 回答 1

1

在 file.vbs(visual basic 脚本)处创建 用外部工具编译到 exe 在服务器任务集这个。

Const HOST = Sample service in IIS
Const URL = "wsPage.asmx"

Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
xmlhttp.open "POST", HOST & URL & "/wsServiceTest", false

'Set the Content-Type header to the specified value
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

' Send the request synchronously
xmlhttp.send "" 
WScript.Echo "Load ok..."
于 2013-10-08T22:38:50.347 回答