I’m trying to consume a SOAP resource via powershell and this one particular WCF service is giving me a really hard time… essentially it’s listening on both http and https, but when I call it https it’s actually calling it http and getting redirected by IIS. I want it to just only use https when called https.
It’s using a basichttpsbinding and looks to be correct, it’s responsive and works on https alone when https is the only binding. But, when http and https bindings in IIS are on, the service is still trying to connect to http even when I specify https. Then it’s redirecting, and if I don’t have allowredirect true it’s showing document moved.
PS E:> $uri="https://asds.net/Bulk/BulkSvc.svc" PS E:> $x2=New-WebServiceProxy -uri $uri -Namespace BulkSvc PS E:> $x2.performance()
(fails) — if I check $x2 the URL property (for the System.Web.Services.Protocols.SoapHttpClientProtocol instance that was created by the new-webserviceproxy call) it shows url : http://asds.net/Bulk/BulkSvc.svc
If I override that with the URI I originally provided:
PS E:> $x2.url=$uri PS E:> $x2.performance()
(it works and when I check $x2 it shows https as the url property now)
Now this is where it gets weird to me… If I turn off the http port 80 binding in IIS, not changing anything else, the initial check of $x2 shows it has an https URL property set right away… so it seems to be setting this when it’s setting up the soap client.
Why is the soap client picking up the https provided uri and actually connecting to http instead? Is this a .net thing, /r/powershell (I’d assume this goes beyond what 9/10 there would know though if so as it relates more to the .net innerworkings I think?)? Is there another easy way to do the equivalent of above lines to test what it instantiates as?