If you need to call a service which is protected using HTTP Basic Authentication with
Apache Axis2, then you could do so by setting the following property on the options object.
- HttpTransportProperties.Authenticator authenticator = new HttpTransportProperties.Authenticator();
- authenticator.setUsername("keith");
- authenticator.setPassword("keith");
- authenticator.setPreemptiveAuthentication(true);
- options.setProperty(HTTPConstants.AUTHENTICATE, authenticator);
HttpTransportProperties.Authenticator authenticator = new HttpTransportProperties.Authenticator();
authenticator.setUsername("keith");
authenticator.setPassword("keith");
authenticator.setPreemptiveAuthentication(true);
options.setProperty(HTTPConstants.AUTHENTICATE, authenticator);
If you are using a generated stub you could get hold of the options object as,
- stub._serviceClient.getOptions();
stub._serviceClient.getOptions();
3 comments:
java.lang.reflect.InvocationTargetException
Hai everyone .
i m using Axis2_Codegen_Wizard_1.3.0 to generate java server side skelton through eclipse..but every time i m getting this exception..
plzzzzzzzzz solve it.
The description you have given would not help anybody answer your question. There is not enough information.
Hi Keith,
Could you give us some example to writing the server side code to enable the basic authentication .
I have written some services, and can access by using rest and different clients. Now I want to add basic authentication,
Thanks,
ayush
Post a Comment