I've just created my first JAX-WS web service client. Previously I used Axis2 in each of my projects.
I'm finding that the JAX-WS client is requiring authentication at 2 different places. I created an Axis2 stub for the same web service and it does not exhibit this behavior.
Here is my code (with necessary redactions):
If the WSDL is allowed to be retrieved anonymously, this code runs fine, with the system only asking for authentication at the second point. If anonymous WSDL access is disabled, I get a 401 Unauthorized error at the first noted point in the code. Again, I only have to provide credentials to the Axis2 stub once, no matter how the WSDL access is configured.
How can I either 1) code it such that credentials are passed only once, or, failing that, 2) provide credentials when the system requests the WSDL?