How to consume webservices over https
- by Kumar
I am trying to consume a webservices which are located at https://TestServices/ServiceList.asmx. When I try to add a service reference to my C# library class project my app.config file looks like below:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="TestServicesSoap" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="50000000" maxBufferPoolSize="524288" maxReceivedMessageSize="50000000"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="">
</transport>
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://TestServices/ServiceList.asmx"
binding="basicHttpBinding" bindingConfiguration="TestServicesSoap"
contract="TestServices.TestServicesSoap" name="TestServicesSoap" />
</client>
</system.serviceModel>
Even when I tried to add a service reference to the https://TestServices/ServiceList.asmx for some reason end point address is still pointing to http://TestServices/ServiceList.asmx. I tried changing the http to https but I am getting the below error:
The provided URI scheme 'https' is invalid; expected 'http'.
Parameter name: via
What is the right way of consuming the webservices on https?