Jax-WS RI authentication

Viewed 32

I am trying to add an Auth header to a url connection made by the Service class with JAX-WS. Currently, I am getting a 401 unauthorized right as I construct the service. The code that is constructing the service looks like (ClassThatExtendsService is just some made up name for the class that is extending the service class):

service = new ClassThatExtendsService(new URL("url");

The second I construct this, I get the 401 error. I see that the error occurs in the RuntimeWsdlParser class, when it calls url.openStream() (the url was passed in through the constructor). I have seen plenty of solutions that suggest setting headers in the BindingProvider from this class, but since the exception has already occurred, that is no good. In addition, I have seen answers that say to call Authenticator.setDefault, but since this code will not work with a global authenticator, that is also no good. Does anyone know how to deal with this issue? Thanks so much

0 Answers
Related