我正在尝试弄清楚如何使用ADB Axis2 1.5版客户端进行基本身份验证.
我正在尝试以下方法:
HttpTransportProperties.Authenticator basicAuth = new HttpTransportProperties.Authenticator();
basicAuth.setUsername(username);
basicAuth.setPassword(password);
final Options clientOptions = serviceStub._getServiceClient().getOptions();
clientOptions.setProperty(HTTPConstants.AUTHENTICATE, basicAuth);
Run Code Online (Sandbox Code Playgroud)
但是这不起作用,并且未添加消息头中所需的行.
Mik*_* C. 19
从以下网站得到答案:
http://www.inpc.de/blog/2007/05/axis2-12-basic-authentication.html
显然我失踪了:
basicAuth.setPreemptiveAuthentication(true);
Run Code Online (Sandbox Code Playgroud)