Powershell, Web Services and Object Types

I am new to using web servicesunder powershell, so maybe I have a major misunderstanding. I work with Microsoft Reporting Services. Here is a reproduction of the script.

$computer = "rptdev"
$uri = "http://$($computer)/ReportServer/ReportService.asmx?WSDL"

$reporting = New-WebServiceProxy -uri $uri -UseDefaultCredential -namespace "ReportingWebService"

$dsRef = new-object ReportingWebService.DataSourceReference
$ds = new-object ReportingWebService.DataSource

$dsRef.GetType()
$ds.GetType()

If I run this, I get something more or less like this:

Name                BaseType
----                --------
DataSourceReference ReportingWebService.DataSourceDefinitionOrReference
DataSource          System.Object

So my question is: why does the DataSource have System.Objectlike BaseTypewhen DataSourceReferenceexplicitly has an object type that is based on a web object? They were created from the namespace ReportingWebService, right?

My problem with the root is that I need to pass the array DataSourcesback to SetItemDataSources, and SetItemDataSourcespinches the array from System.Objects, and I can't seem to drop it what I want.

+5
2

, DataSource System.Object. "DataSourceReference" "DataSourceDefinitionOrReference", , - , System.Object.

, , . , , PowerShell System.Object. , , ( API, , ):

$computer = "rptdev"
$uri = "http://$($computer)/ReportServer/ReportService.asmx?WSDL"

$reporting = New-WebServiceProxy -uri $uri -UseDefaultCredential -namespace "ReportingWebService"

[ReportingWebService.DataSource[]]$DataSources = <do something to get your data sources>
$reporting.SetItemDataSources($DataSources)
+2

, (.. - ), @():

ps> $o = new-object mynamespace.myobj
ps> $thing.Method( @($o) )

-Oisin

0

All Articles