0

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!

  • `$proxy.GetCases` in the console should return all the constructors which you can use to verify arguments. Assuming that `$WS_CaseService` doesnt already have supporting documentation. – Matt Aug 15 '18 at 12:30
  • Thanks Matt. So it looks like the parameter that I have to supply is 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) How can I use this information? – Eirik Johannessen Aug 15 '18 at 12:57
  • Can you show that detail in the question? harder to read in comments. It looks like you need to build a CasesQuery first that you can supply to `.GetCases()`. `$proxy |gm` would help. Unless you have direct access to documentation this is going to be difficult to help as I am just guessing and do not have access to your environment. – Matt Aug 15 '18 at 13:08
  • Thanks again. It's starting to become clearer. I'll try to construct an object CasesQuery and pass it to .GetCases(). – Eirik Johannessen Aug 15 '18 at 13:15

0 Answers0