Powershell and SOAP requests Updated 151110
There is an example page on how to send and receive SOAP request from a weather page.
One example of how to get current temperature in Tampa USA using SOAP and powershell is:
$sun = New-WebServiceProxy -Uri "http://www.webservicex.net/globalweather.asmx?WSDL"
[xml]$xml=$sun.GetWeather("tampa","United states")
$xml | get-member -MemberType property
#Get member of CurrentWeather
$xml.CurrentWeather | Get-Member -MemberType property
Write-host "temperatuere is: " $xml.CurrentWeather.Temperature
Another example is by using an XML-file and sending it using a powershell-script:
[xml]$xml=Invoke-WebRequest -Uri
"http://www.webservicex.net/globalweather.asmx?WSDL" -Method Post
-ContentType "text/xml" -InFile
C:\Users\rikard\Desktop\GetWheatherTest\getwind.xml
[xml]$x=$xml.Envelope.Body.GetWeatherResponse.GetWeatherResult
Write-host "temperatuere is: " $x.CurrentWeather.Temperature
XML-file to be used:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetWeather xmlns="http://www.webserviceX.NET">
<CityName>Tampa</CityName>
<CountryName>United states</CountryName>
</GetWeather>
</soap:Body>
</soap:Envelope>
Received XML-file when outfile is used:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetWeatherResponse xmlns="http://www.webserviceX.NET">
<GetWeatherResult><?xml version="1.0"
encoding="utf-16"?>
<CurrentWeather>
<Location>TAMPA INTERNATIONAL AIRPORT , FL, United States
(KTPA) 27-58N 082-32W 11M</Location>
<Time>Nov 10, 2015 - 03:53 PM EST / 2015.11.10 2053 UTC</Time>
<Wind> from the NNW (330 degrees) at 12 MPH (10 KT):0</Wind>
<Visibility> 10 mile(s):0</Visibility>
<SkyConditions> mostly clear</SkyConditions>
<Temperature> 81.0 F (27.2 C)</Temperature>
<DewPoint> 68.0 F (20.0 C)</DewPoint>
<RelativeHumidity> 64%</RelativeHumidity>
<Pressure> 30 in. Hg (1015 hPa)</Pressure>
<PressureTendency> 0.01 inches (0.4 hPa) lower than three hours ago</PressureTendency>
<Status>Success</Status>
</CurrentWeather>
</GetWeatherResult>
</GetWeatherResponse>
</soap:Body>
</soap:Envelope>
The answer I received in both cases was:
temperatuere is: 81.0 F (27.2 C)