WebServiceProxy

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")

The web server is returning that error. Keep in mind that, unlike IE, Web service proxies do not automatically know how to pass along Windows credentials. Generally speaking, web services aren’t set up to require integrated authentication - it’s not the usual model, at least.

Hello Mr. Jones,

Is there any reason why it works when just using HTTP but not in HTTPS?
Also, it looks like the authentication is ok, but it fails when executing “$Web.Mymethod(“TES01”,“text1”,text2”)".

Clarification on the authentication, the authentication that I would like to use is digest authentication so I can restrict users in combination with HTTPS to add security.

Thanks,