I'm trying to call the following method (from a WSE service proxy):
Name MemberType Definition
---- ---------- ----------
SetClientCredential Method System.Void SetClientCredential[TSecurityToken](TSecurityToken clientToken)
I keep getting the following error:
Exception calling "SetClientCredential" with "1" argument(s): "Value cannot be null.
Parameter name: key"
At E:\Path\To\Script.ps1:70 char:33
+ $service.SetClientCredential <<<< ($userToken)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : CatchFromBaseAdapterMethodInvoke
I have verified $userToken is not null. The exception stack trace suggests to me that PowerShell is looking for the SetClientCredential method and not finding it:
at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
at System.Collections.Generic.Dictionary`2.ContainsKey(TKey key)
at System.Management.Automation.LanguagePrimitives.TypeConverterPossiblyExists(Type type)
at System.Management.Automation.LanguagePrimitives.FigureConversion(Type fromType, Type toType)
at System.Management.Automation.LanguagePrimitives.ConvertTo(Object valueToConvert, Type resultType, Boolean recursi
on, IFormatProvider formatProvider, TypeTable backupTypeTable)
at System.Management.Automation.Adapter.PropertySetAndMethodArgumentConvertTo(Object valueToConvert, Type resultType
, IFormatProvider formatProvider)
at System.Management.Automation.Adapter.MethodArgumentConvertTo(Object valueToConvert, Boolean isParameterByRef, Int
32 parameterIndex, Type resultType, IFormatProvider formatProvider)
at System.Management.Automation.Adapter.SetNewArgument(String methodName, Object[] arguments, Object[] newArguments,
ParameterInformation parameter, Int32 index)
at System.Management.Automation.Adapter.GetMethodArgumentsBase(String methodName, ParameterInformation[] parameters,
Object[] arguments, Boolean expandParamsOnBest)
at System.Management.Automation.DotNetAdapter.MethodInvokeDotNet(String methodName, Object target, MethodInformation
[] methodInformation, Object[] arguments)
at System.Management.Automation.Adapter.BaseMethodInvoke(PSMethod method, Object[] arguments)
Clearly, the problem is that I'm trying to call a templated method and I'm not invoking it properly. Does anybody know how to call a templated method?