Requirement is to call a Java Web Service. There is a WSDL provided. Call is successful in unsecured fashion. Now the service call needs to be authenticated. Service call will be successful only via a paricular windows userid/password. Since everything in our application is config based, we don’t want to hard-code anything in code. Appreciate if someone can show how to do so ?
I have this config by the way….
<basicHttpBinding>
<binding name="MyBinding" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:30:00" sendTimeout="00:10:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
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="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
You can’t set the username/password anywhere in the WCF-specific configuration. You can, however, set the username/password pair as application settings, retrieve them from the code, and set them in the WCF client.
and in the code: