1 Reply Latest reply on Jan 14, 2010 10:21 PM by Ian Ian

    JBoss 6.0.0 M1 and Authenticator not appearing to work

    Ian Ian Newbie

      Hi, I'm having some issues with calling an external web service from JBoss 6.0.0 M1. I'm using the "standard" server if that has an impact.


      The external web service using basic authentication, so I use Authenticator.setDefault() to set a custom Authenticator, which provides the username and password. However this has no effect and when I debug the server, the Authenticator is never called. This would explain it.


      However when I run exactly the same code as a standalone client (I added a main method to the class), the Authenticator is called and everything works how I would expect it.


      Is there a restriction on Authenticator.setDefault() in JBoss 6.0.0 M1? Am I not allowed to call Authenticator.setDefault() (or is it silently ignored when I call it)? Or can I do it but then, why is my authenticator not being called?


      Here is the basic code that does the call:


          Authenticator.setDefault(new BroadcastAuthenticator(username, password));   // Constructing my authenticator
          CommsIncomingMessageService service = new CommsIncomingMessageService();          // My web service
          CommsIncomingMessage requestInvoker = service.getCommsIncomingMessagePort();     // Getting an instance of it


          BindingProvider provider = (BindingProvider)requestInvoker;
          provider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
          provider.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, username);
          provider.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, password);




      Any ideas, before I pull out what remaining hair I have?