【发布时间】:2015-09-14 21:14:19
【问题描述】:
我在为 XML 形式的 SOAP 调用分配值时遇到问题。该值在变量中定义,但 Powershell 不断返回此错误:
"不能设置"属性",因为只有字符串可以用作值 设置 XmlNode 属性”
我的变量定义为字符串:[string]$AvidDisplayNameMinusTransfer
这是带有变量的 SOAP 调用:
$soap = [xml]@'
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://avid.com/interplay/ws/assets/types">
<soapenv:Header>
<typ:UserCredentials>
<typ:Username>***</typ:Username>
<typ:Password>***</typ:Password>
</typ:UserCredentials>
</soapenv:Header>
<soapenv:Body>
<typ:Search>
<typ:InterplayPathURI>interplay://AvidEng103/LTW</typ:InterplayPathURI>
<typ:SearchGroup Operator="AND">
<!--Zero or more repetitions:-->
<typ:AttributeCondition Condition="EQUALS">
<typ:Attribute Group="USER" Name="Display Name"></typ:Attribute>
</typ:AttributeCondition>
</typ:SearchGroup>
<typ:ReturnAttributes>
<typ:Attribute Group="SYSTEM" Name="MOB ID"></typ:Attribute>
</typ:ReturnAttributes>
</typ:Search>
</soapenv:Body>
</soapenv:Envelope>
'@
$soap.Envelope.Body.Search.SearchGroup.AttributeCondition.Attribute = $AvidDisplayNameMinusTransfer
如果有人需要我的整个代码来提供更好的上下文,请告诉我。
【问题讨论】:
标签: powershell soap