1

Getting below error while sending a SOAP request with NTLM Authentication.

Caused by: org.apache.cxf.transport.http.HTTPException: HTTP response '401: Unauthorized' when communicating with URI http://********. at 
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1581)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1533)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1336)
    at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:56)
    at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:215)
    at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
    at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:652)
    at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
    ... 54 more

Problem occurred when sending a large XML request payload size. It works fine when the payload size is smaller.

Tried setting content length at header but did not worked.

Robert Smith
  • 457
  • 2
  • 9
  • 25
  • What is the code that causes this error? – user10089632 Aug 28 '17 at 12:37
  • Especially the line that performs the authentication – user10089632 Aug 28 '17 at 12:38
  • public class NtlmAuthenticator extends Authenticator { private final String username; private final char[] password; public NtlmAuthenticator(final String username, final String password) { super(); this.username = new String(username); this.password = password.toCharArray(); } @Override public PasswordAuthentication getPasswordAuthentication() { return (new PasswordAuthentication (username, password)); } public TestClass(String username, String password){ NtlmAuthenticator authenticator = new NtlmAuthenticator(username,password); Authenticator.setDefault(authenticator); } – Robert Smith Aug 29 '17 at 12:05
  • TestWebServicesPort port = rws.getWebServicesPort(); //Below line gives 401 authentication error port.webRequest(new Holder(pxmlRequest), response); – Robert Smith Aug 29 '17 at 12:06
  • You probably hit one of the open issues: https://issues.apache.org/jira/issues/?jql=project%20%3D%20CXF%20AND%20resolution%20%3D%20Unresolved%20AND%20text%20~%20%22ntlm%22%20ORDER%20BY%20priority%20DESC%2C%20updated%20DESC – Dennis Kieselhorst Sep 02 '17 at 10:32

0 Answers0