Hi,
I have to connect from a Java client to a WCF Web Service which has the following binding configuration:
<basicHttpBinding>
<binding name="basicHttpBindingSecurity">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Basic"/>
</security>
</binding>
</basicHttpBinding>
I'm using JAX-WS. Can you give me a code snippet showing how to set user name and password in a Java client?
I have tried this:
Map<String, Object> reqContext = ((BindingProvider) port).getRequestContext();
reqContext.put(BindingProvider.USERNAME_PROPERTY, "username");
reqContext.put(BindingProvider.PASSWORD_PROPERTY, "password");
but it did not work. I have also tried this:
Map<String, Object> reqContext = ((BindingProvider) port).getRequestContext();
reqContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://username:password@localhost:8090/MyService");
Still no success.
Thanks, Rafal