有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 –