我是编码的初学者。
我必须在下面拨打网络服务: 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
任何人都可以帮助我吗?
答案 0 :(得分:1)
在file.vbs创建(可视化基本脚本) 使用外部工具编译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..."