Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2314

New-WebServiceProxy converting Problem

$
0
0

Hi,

I am trying to call the webservice from cloud hoster filebox. Via the webservice test-tool SoapUI it works great. But via Powershell I am getting a converting error. I've tried many things, but can't get to a solution.

The script actually looks pretty simple:

$proxy = New-WebServiceProxy -URI 'https://www.filebox-solution.com/fbws/services/FileboxService?wsdl'

$type = $proxy.GetType().Namespace

$inDTO   = new-object($type + ".PasswordAuthInDTO")
$return  = new-object ($type + ".PasswordAuthOutDTO")

$inDTO.clientCorrelator = ''
$inDTO.clientVersion = ''
$inDTO.username = 'user'
$inDTO.password = 'pass'

$return = $proxy.passwordAuthentication($inDTO)

The script should call the following webservice method (body):

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.fbws.csnc.ch" xmlns:xsd="http://dto.fbws.csnc.ch/xsd"><soapenv:Header/><soapenv:Body><ser:passwordAuthentication><!--Optional:--><ser:inDTO><!--Optional:--><xsd:clientCorrelator>?</xsd:clientCorrelator><!--Optional:--><xsd:clientVersion>?</xsd:clientVersion><!--Optional:--><xsd:password>?</xsd:password><!--Optional:--><xsd:username>?</xsd:username></ser:inDTO></ser:passwordAuthentication></soapenv:Body></soapenv:Envelope>


The error message is this (translated from german):

The argument "inDTO" with the value ""Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1s_services_FileboxService_wsdl.PasswordAuthInDTO"" for "passwordAuthentication" cannot be converted to type 
""Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1s_services_FileboxService_wsdl.PasswordAuthInDTO"" can be converted: "The value 
""Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1s_services_FileboxService_wsdl.PasswordAuthInDTO"" of type 
""Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1s_services_FileboxService_wsdl.PasswordAuthInDTO"" can't get into the type 
""Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1s_services_FileboxService_wsdl.PasswordAuthInDTO"" can be converted."

For me, it seems as if it is trying to convert the variable into a type it already has.

Any help is greatly appreciated!


Viewing all articles
Browse latest Browse all 2314


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>