在使用任何 Remedy Web 服务时,我在插入身份验证信息时遇到了相当大的困难。
$URL = "https://itsm.url.com/arsys/WSDL/public/server_name/HPD_IncidentInterface_WS";
$URI = New-Object System.Uri($URL);
$ITSM = New-WebServiceProxy -Uri $URI -Namespace ITSM;
$Credentials = New-Object ITSM.AuthenticationInfo;
$Credentials.userName = "UserName";
$Credentials.password = "PassworD";
$Credentials.authentication = '';
$ITSM.AuthenticationInfoValue = $Credentials;
代码在最后一行显示。这是生成的错误消息:
Exception setting "AuthenticationInfoValue": "Cannot convert the "ITSM.AuthenticationInfo" value
of type "ITSM.AuthenticationInfo" to type "ITSM.AuthenticationInfo"."
At C:\\ITSM Automation\Automate Incident Modification.ps1:45 char:8
+ $ITSM. <<<< AuthenticationInfoValue = $Credentials;
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
“无法将“ITSM.AuthenticationInfo”类型的“ITSM.AuthenticationInfo”值转换为“ITSM.AuthenticationInfo”类型。” ...嗯什么?如何解决这个问题?
如果有人有想法,我会全力以赴。
可以在此处找到函数“New-WebServiceProxy” 。