1
刚刚使用Apache Axis 2从WSDL生成的Java代码。该服务受基本认证保护。当我尝试创建身份验证对象以设置用户名和密码时,在该库中找不到类(HttpTransportProperties.Authenticator
)。在Axis2中找不到HttpTransportProperties.Authenticator
如何为由生成的客户端代码设置基本身份验证Apache Axis2?
这里是老办法设置基本身份验证则params的:
HttpTransportProperties.Authenticator basicAuth = new HttpTransportProperties.Authenticator();
basicAuth.setUsername("username");
basicAuth.setPassword("password");
basicAuth.setPreemptiveAuthentication(true);
final Options clientOptions = stub._getServiceClient().getOptions();
clientOptions.setProperty(HTTPConstants.AUTHENTICATE, basicAuth);
stub._getServiceClient().setOptions(clientOptions);