Hi Colin,
In version 6.0.0, we migrated our products from .NET Framework 4.8 to .NET 8, which is not compatible with PowerShell 5.1 and can only work with PowerShell 7.4.
New-WebServiceProxy is unavailable in PowerShell 7.4 because it relies on the legacy .NET Framework module (System.Web.Services) that was not ported to modern .NET.
Temporary workaround
As a temporary workaround, you can try the following.
1. Move your script to a separate PowerShell script file:
#Powershell script om SOAP GET request doen. GetData
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string]$OwnUrl,
[Parameter(Mandatory = $true)]
[string]$OwnToken,
[Parameter(Mandatory = $true)]
[string]$OwnConnectorId
)
[Int]$Skip = 0
[Int]$Take = 100000000
[String]$FiltersXml = ""
[String]$Token = "1$($OwnToken)"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
$WebServiceProxy = New-WebServiceProxy -Uri $OwnUrl
$WebServiceProxy.GetData($Token, $OwnConnectorId, $FiltersXml, $Skip, $Take)
2. Replace your PowerShell action with the Run program action, configured as follows:
Application: leave empty
Working directory: leave empty
Arguments: choose text and add the following command:
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "<path to the file created on step 1>" -OwnUrl "{own url}" -OwnToken "{own token}" -OwnConnectorId "{own connectorid}"
Capture output: checked
If your script uses other EasyMorph parameters, you'll need to provide them as PowerShell script parameters as well.
Recommended migration
We recommend rewriting your scripts to use the Invoke-WebRequest method. This will looks something like this:
#Powershell script om SOAP GET request doen. GetData
[String]$Token = "1{own token}"
[String]$connectorId = "{own connectorid}"
[Int]$Skip = 0
[Int]$Take = 100000000
[String]$FiltersXml = ""
[String]$url = "{own url}"
# Build SOAP envelope (adjust XML namespace and element names to match your service WSDL)
$soapEnvelope = @"
<?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>
<GetData xmlns="http://tempuri.org/">
<Token>$Token</Token>
<connectorId>$connectorId</connectorId>
<FiltersXml>$FiltersXml</FiltersXml>
<Skip>$Skip</Skip>
<Take>$Take</Take>
</GetData>
</soap:Body>
</soap:Envelope>
"@
$headers = @{
"SOAPAction" = "$url/GetData" # Adjust to match your endpoint's SOAPAction
}
$response = Invoke-WebRequest -Uri $url -Method Post -ContentType "text/xml; charset=utf-8" -Headers $headers -Body $soapEnvelope
[xml]$xmlResult = $response.Content
P.S. Are you also running this script in EasyMorph Sever/Hub?