我刚刚开始使用 PowerShell 和 SOAP Webservices。
我正在使用 New-WebserviceProxy,但无法找到正确数量的查询参数。
我尝试使用的服务方法如下所示:
<xs:element name="GetCases">
<xs:complexType>
<xs:sequence>
<xs:element name="parameter" type="tns:GetCasesQuery" nillable="true" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="GetCasesQuery">
<xs:sequence>
<xs:element name="ADContextUser" type="xs:string" nillable="true" minOccurs="0"/>
<xs:element name="AdditionalFields" type="tns:ArrayOfAdditionalFieldParameter" nillable="true" minOccurs="0"/>
<xs:element name="ArchiveCode" type="xs:string" nillable="true" minOccurs="0"/>
<xs:element name="CaseNumber" type="xs:string" nillable="true" minOccurs="0"/>
<xs:element name="CategoryCode" type="xs:string" nillable="true" minOccurs="0"/>
<xs:element name="ContactReferenceNumber" type="xs:string" nillable="true" minOccurs="0"/>
<xs:element name="ExternalId" type="tns:ExternalIdParameter" nillable="true" minOccurs="0"/>
<xs:element name="IncludeCustomFields" type="xs:boolean" minOccurs="0"/>
<xs:element name="IncludeReferringCases" type="xs:boolean" minOccurs="0"/>
<xs:element name="IncludeReferringDocuments" type="xs:boolean" minOccurs="0"/>
<xs:element name="MaxReturnedCases" type="xs:int" nillable="true" minOccurs="0"/>
<xs:element name="ProjectNumber" type="xs:string" nillable="true" minOccurs="0"/>
<xs:element name="Recno" type="xs:int" nillable="true" minOccurs="0"/>
<xs:element name="Title" type="xs:string" nillable="true" minOccurs="0"/>
<xs:element name="IncludeAccessMatrixRowPermissions" type="xs:boolean" minOccurs="0"/>
<xs:element name="IncludeCaseContacts" type="xs:boolean" minOccurs="0"/>
<xs:element name="IncludeCaseEstates" type="xs:boolean" minOccurs="0"/>
<xs:element name="LastDate" type="xs:dateTime" nillable="true" minOccurs="0"/>
<xs:element name="OnlyPublicInfo" type="xs:boolean" minOccurs="0"/>
<xs:element name="Page" type="xs:int" nillable="true" minOccurs="0"/>
<xs:element name="SortCriterion" type="q4:SortCriterion" nillable="true" minOccurs="0" xmlns:q4="http://schemas.datacontract.org/2004/07/SI.Data.Contracts.WS"/>
</xs:sequence>
</xs:complexType>
在我看来,好像有 21 个参数,但是当我运行脚本时:
$Credentials = Get-Credential
$proxy = New-WebServiceProxy -Uri $WS_CaseService -Credential $Credentials -Namespace "WebService"
$proxy.GetCases($null, $null, $null, "17/00004", $null, $null, $null, $false, $false, $false, $null, $null, $null, $null, $false, $false, $false, $null, $false, $null, $null)
我收到消息“找不到“GetCases”的重载和参数计数:“21”。
proxy.GetCases 的输出:
WebService.GetCasesResult, quutbtyz, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null GetCases(WebService.GetCasesQuery , quutbtyz, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null parameter)
如果有人能指出我正确的方向,我会非常高兴!