作者:请叫我浪漫先生_858 | 来源:互联网 | 2022-12-18 19:21
Imnewtousingwebservicesunderpowershell,somaybeIhaveabasicmisunderstandingaboutsomet
I'm new to using web services
under powershell
, so maybe I have a basic misunderstanding about something. I'm working with Microsoft's Reporting Services
. Here is a repro script.
我刚接触PowerShell下的web服务,所以也许我对某些事情有一个基本的误解。我正在使用Microsoft的Reporting Services。这是一个repro脚本。
$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 that, I get something that looks more or less like this:
如果我运行它,我得到的东西看起来或多或少像这样:
Name BaseType
---- --------
DataSourceReference ReportingWebService.DataSourceDefinitionOrReference
DataSource System.Object
So, my question is: Why does DataSource have System.Object
as a BaseType
when DataSourceReference
clearly has a object type that is based on the web object? They were both created from the ReportingWebService
namespace, weren't they?
所以,我的问题是:当DataSourceReference明显具有基于Web对象的对象类型时,为什么DataSource将System.Object作为BaseType?它们都是从ReportingWebService命名空间创建的,不是吗?
My root problem is that I need to hand an array of DataSources
back to SetItemDataSources
, and SetItemDataSources
chokes on an array of System.Objects
, and I don't seem to be able to cast it to what I want.
我的根本问题是我需要将一个DataSource数组交给SetItemDataSources,并在System.Objects数组上使用SetItemDataSources choke,我似乎无法将它转换为我想要的。
2 个解决方案