SOAP Example

This is a bit of example code for connecting to a SOAP API that uses an auth call and cookies for logging into the API. For more complex type like xml you will have to handle the output.

# Connection vars
$HostName = ''
$UserName = ''
$Password = ''
$SoapUrl = "http://$HostName/soap3/api.wsdl";
$Client = New-WebServiceProxy -Uri $SoapUrl
$Client.CookieContainer = New-Object System.Net.CookieContainer
if(!$Client.authenticate($UserName, $Password))
{
    Write-Host -BackgroundColor black -ForegroundColor red "Unable to connect to $HostName"
}
$Client.getAuthenticatedLevel()
$a = $Client.core_getDevices()
$a.getType()
$a