0
votes

Getting this error while calling the service.

401 - Unauthorized: Access is denied due to invalid credential

I tried creating a NtlmAuthenticator class which extends Authenticator and passing on the credentials with DOMAIN\USERNAME and PASSWORD format. Also set Authenticator.setDefault(ntlmAuthenticator). Doesnt't works out.

Any response would be very helpful.

1

1 Answers

0
votes

On following the Oracle documentation found out that NTLM can be used with proxies or servers, but not with both at the same time.

Used apache CXF and this time it worked.

Added the below code

Client client = ClientProxy.getClient(port);
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(36000);
//httpClientPolicy.setAllowChunking(false);
http.setClient(httpClientPolicy);