Hi, I'm trying to deploy a webapp on Tomcat 8.0.33 running as a windows service. The webapp is based on Spring Boot (not sure if relevant).
The webapp calls external SOAP web services that have been published on another machine (by Navision, Microsft's ERP). To authenticate and be able to call these web services I've created a class extending java.net.Authenticator. This class overrides getPasswordAuthentication() to return the domain, user and password to be used to call the web services. This class is registered using Authenticator.setDefault(). The problem I'm struggling with is the following : - when I run my application in Eclipse using Spring boot's main class everything is working fine. - when I deploy the application using jetty-runner, everythin's working fine too - but when I deploy my war on Tomcat, my custom Authenticator class is never called to get the required credentials to call the external Web services. The authenticator registration is made during the startup. I've checked this in debug mode. Using Wireshark I've been comparing the working and failing cases. The working cases (Eclipse or Jetty) consist in this conversation : => POST /url/to/ws HTTP HTTP/1.1 <= HTTP/1.1 401 Unauthorized => POST /url/to/ws HTTP HTTP/1.1 , NTLMSSP_NEGOTIATE <= HTTP/1.1 401 Unauthorized , NTLMSSP_CHALLENGE => POST /url/to/ws HTTP HTTP/1.1 , NTLMSSP_AUTH, User : MYDOMAIN\myuser <= HTTP/1.1 200 OK The failing case (Tomcat as windows service) consists in this conversation : => GET /url/to/ws HTTP HTTP/1.1 <= HTTP/1.1 401 Unauthorized => GET /url/to/ws HTTP HTTP/1.1 , NTLMSSP_NEGOTIATE <= HTTP/1.1 401 Unauthorized , NTLMSSP_CHALLENGE => GET /url/to/ws HTTP HTTP/1.1 , NTLMSSP_AUTH, User : \ <= HTTP/1.1 403 Forbidden I see 2 differences here. The use of GET instead of POST. I have no clue why this happens, the code is exactly the same. And there is no user/password provided, which seems to be consistent as my authenticator does not get called. At last, when I try to access the url from my browser I get the same conversation as with Tomcat, but I can provide my credentials through the prompt dialog and then access my WSDL. This leads me to think that the GET vs POST may not be the problem. Could someone explain what I could do now to be able to call my web services ? What other information would be useful ? Thanks, Stéphane Thibaudeau.