PowerShell + BMC Remedy + Web Services

时间:2012-03-30 17:04:31

标签: web-services soap powershell remedy

在使用任何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”函数here

1 个答案:

答案 0 :(得分:1)

在会话中重复使用相同的WebServiceProxy值时,Namespace上报告了一个错误。如果你正在点击它,你可以关闭并重新打开PowerShell,或者避免使用-Namespace参数。

请参阅Microsoft Connect上的错误报告。