I have just started out with PowerShell and SOAP Webservices.
I'm using New-WebserviceProxy and I have trouble finding the correct number of arguments for a query.
The service method I'm trying to use looks like this:
<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>
To me it look's as if there are 21 arguments, however when I run the script:
$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)
I get the message "Cannot find an overload for "GetCases" and the argument count: "21".
Output from 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)
If anyone could point me in the right direction I would be very happy!