我尝试了一些东西,最后终于成功了。
我确实将绑定从WCF WSHttp更改为WCF BasicHttp。
我也遵循了这一点
post
,这表示他们只通过使用自动生成的名称空间使其工作。
我仍然对-namespace和-class参数感到困惑,因为上面的帖子说它只通过使用自动生成的名称空间(省略-namespace parm时会发生这种情况)才能使进程工作。
我的代码最终是这样的:
# Create the WebSvcURL variable and pass the WSDL URL
$WebSvcURL= âhttp://localhost/DEMO/SetPassKey/SetPassKey_Logic_SetPassKeyWebService_SetPassKeyWCF.svc?wsdlâ
#Create the Web Service Proxy Object
$serviceProxy = New-WebServiceProxy -Uri $WebSvcURL -UseDefaultCredential
$autoGenNamespace = $serviceProxy.getType().namespace
write-host "Namespace=$namespace"
$req = New-Object ($autoGenNamespace + ".SetPassKeyOrchWebRequest")
$resp = New-Object ($autoGenNamespace + ".SetPassKeyOrchWebResponse")
$req.NewPassKey = "TEST" # <--- PUT YOUR NEW PASSWORD HERE
$req.NewPassKey = "TEST" # <--- PUT YOUR NEW PASSWORD HERE
Write-Host "Request:"
Write-Host ($req | Format-Table | Out-String)
Write-Host "About to call WebService"
$resp = $serviceProxy.SetPassKey($req)
Write-Host "Response:"
Write-Host ($resp | Format-Table | Out-String)