- January 21, 2016 at 6:48 am #34119
I have a script that connects to a web service to retrieve customer details for use in configuring a server. Later on in the script it connects to a BITS service to obtain installation files.
Both use New-WebServiceProxy and [ref] variables to export the data:
$cproxy = New-WebServiceProxy -Uri "http://first.domain.com/clientupdatewebservice.asmx" $cproxy.CheckInstallationIdV2($installcode, [ref]$company, [ref]$dnsadd, [ref]$null, [ref]$null, [ref]$null) ... $bproxy = New-WebServiceProxy -Uri http://second.domain.com/rmsdownloadservice.asmx -Credential $cred $bits = New-Object -Type Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1ms_com_downloadservice_asmx.Directory $bproxy.GetLatestVersionDetails([ref]$bits) | Out-Null
This has been running perfectly fine until today, which I now realise is because currently there is no restart between the two sections while previously there was. The error I'm getting is that the type for $bits cannot be found.
If I run the two individually it's fine, but once the first proxy is created I can't create the object for $bits (nor does it want to accept anything like PSObject or Object or whatever, it has to be the exact type AFAIK). Disposing the original proxy doesn't help either.January 21, 2016 at 7:07 am #34120
New-WebServiceProxy has a -Namespace parameter that you can use to control these conflicts. (Your type names passed to New-Object will also change slightly to match the Namespace you've specified.)January 21, 2016 at 7:20 am #34121
Ahhhh because it's using the same namespace as the original proxy which of course then doesn't include the class I need.
You must be logged in to reply to this topic.