I have a web-servie (ws) and I would like to use Windows authentication in order to control allowed users to the ws.
I am able to use WebServiceProxy to connect to the ws using HTTP without any issues, but if I use HTTPS, then it fails with this error: "Exception calling “Mymethod” with “3” argument(s): “The request failed with HTTP status 401: Unauthorized.”
Any idea as to why I am getting this error? I am only experiencing this error if I use the WebServiceProxy connection from a computer that is not part of the domain.
*** Works ***
$URI = "http://myserver/mywebservice/myapp.asmx" $User = "domain\user" $secureStringpassword = ConvertTo-SecureString -String "password" -AsPlainText -Force; $MyCredential = New-Object -TypeName System.Management.Automation.PSCredential ($User, $secureStringpassword); $Web = New-WebServiceProxy -Uri $URI -Credential $MyCredential $Web.Mymethod("TES01","text1",text2")
*** Doesn’t Work ***
$URI = "https://myserver/mywebservice/myapp.asmx" $User = "domain\user" $secureStringpassword = ConvertTo-SecureString -String "password" -AsPlainText -Force; $MyCredential = New-Object -TypeName System.Management.Automation.PSCredential ($User, $secureStringpassword); $Web = New-WebServiceProxy -Uri $URI -Credential $MyCredential $Web.Mymethod("TES01","text1",text2")