Example PowerShell Script - EcoSys - Training - Hexagon PPM

Integrating EcoSys API with PowerShell Tutorial

Language
English
Product
EcoSys
Search by Category
Training
EcoSys Version
8.8

# Create credentials

$username = "admin"

$password = "secret"

$secstr = New-Object -TypeName System.Security.SecureString

$password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}

$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secstr

# Create web service, provide wsdl & credentials   

$proxy = New-WebServiceProxy -uri http://myserver:8080/ecosys/api/wsdl11/SampleAPI/SampleAPI.wsdl -Namespace ns -Credential $cred

# Create Options (and parameters if needed)

$cfo = New-Object ns. SampleAPI

$cfo.Username = "admin"

$cfo.Password = "secret"

# Create any needed request object, here is read

$req = New-Object ns. SampleAPI

# Make request call

$proxy.ReadSampleAPI($req)