1

私はコーディングの初心者です。

以下の Web サービスを呼び出す必要があります: 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(ビジュアルベーシックスクリプト)に作成 外部ツールでコンパイルして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 に答える