有PS script驗證Web服務和它的作品:PowerShell的web服務查詢
$SiteURL = "http://wsf.cdyne.com/WeatherWS/Weather.asmx?op=GetCityWeatherByZIP"
$request = [Net.HttpWebRequest]::Create($SiteURL)
try
{
#Get the response from the requst
$response = [Net.HttpWebResponse]$request.GetResponse()
Write-Host "The service is running."
$request.Abort()
}
Catch
{
Write-Warning "The service of site does not run or maybe you don't have the Credential"
}
但我怎麼能指定的查詢參數,ZIP?
你甚至讀過你提到過的頁面嗎?看一下'HTTP GET'部分,你應該能夠將你需要的東西拼湊在一起,以便在你的請求中指定一個郵政編碼。 – TheMadTechnician
這頁上的HTTP GET部分在哪裏? – Alexan
@alex在http://wsf.cdyne.com/WeatherWS/Weather.asmx?op=GetCityWeatherByZIP –