Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources: Active Threads
Viewing all articles
Browse latest Browse all 8411

Trying to figure out why a webservice object type will not work in method call

$
0
0

I instantiated a base object from a webservice, and, attempted to create some objects from this base object this way:

$webservice =New-WebServiceProxy-Uri http://www.test.com/myclass.asmx -Namespace Test

When I create new objects from this I use this approach:

$list =New-ObjectTest.List-Property@{
  name ='Test';
  item ='something';}

When I attempt to use this custom object in a method, I get an error:

$webservice.GetList($list)Cannot convert argument "list",with value:"Test.List",for"GetList" to type"Test.List":"Cannot convert the "Test.List" value of type "Test.List" to type"Test.List"."

When I check the object to see it's type and members I get this:

$test.GetType()IsPublicIsSerialNameBaseTypeTrueTrueListSystem.Object

$test | gmTypeName:Test.List# This is all I care about

According to these two approaches, there seems to be some funkiness going on with the New-Object approach I am using. Test (the namespace) is inferred, but, not used (at least not in the GetType() call), and, I am wondering if this may be the cause of the error.


Viewing all articles
Browse latest Browse all 8411

Trending Articles