This example will call a web service to get the weather.

First , create a reference to the web service.

$uri = “http://ws.cdyne.com/WeatherWS/Weather.asmx
$ws = New-WebServiceProxy -Uri $uri

To see what methods are available:

$ws | Get-Member -MemberType Method

To get the definition for the service:

($ws | Get-Member -Name GetCityWeatherByZIP).definition

To call the service to get all weather data for ZIP 30080 (Smyrna, GA):

$ws.GetCityWeatherByZIP(“30080”)

Or to just display certain pieces of information:

$Weather = $ws.GetCityWeatherByZIP(“30080”)
Write-Host “City: “$Weather.City.ToString()
Write-Host “Description: “$Weather.Description.ToString()
Write-Host “Temperature: “$Weather.Temperature.ToString()