I'm using JBossWS 1.2 (JAX-WS 2.0) to access a web service, which requires http basic authentication. In the JBoss JAX-WS user guide I didn't find any example of how to provide username/password in a JBossWS web service client.
In the JBossWS forum I found the following custom solution:
It basically adds a new annotation CallProperties, the content of which is then added to the endpoint metadata when processed by the JSR181ClientMetaDataBuilder and JSR181MetaDataBuilder classes.
Which is the proposed way of adding http basic authentication in a JBossWS client?
See WebServiceContextJSETestCase in the samples:
port = (TestEndpoint)service.getPort(TestEndpoint.class); BindingProvider bp = (BindingProvider)port; bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "kermit"); bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "thefrog");