【发布时间】:2011-08-17 10:57:37
【问题描述】:
我有一个axis2 (v1.5.3) 客户端,需要使用IIS 进行Kerberos/NTLM 身份验证。我怎样才能做到这一点?这是我现在拥有的代码,它失败并出现401 - unauthorized 错误:
List<String> authScheme = new ArrayList<String>();
authScheme.add(HttpTransportProperties.Authenticator.NTLM);
HttpTransportProperties.Authenticator ntlm =
new HttpTransportProperties.Authenticator();
ntlm.setAuthSchemes(authScheme);
ntlm.setUsername("Administrator");
ntlm.setPassword("password");
ntlm.setHost("http://server/_vti_bin/someservice.asmx");
ntlm.setPort(80);
ntlm.setDomain("server_domain");
Options options = webs._getServiceClient().getOptions();
options.setProperty(HTTPConstants.AUTHENTICATE, ntlm);
stub._getServiceClient().setOptions(options);
用 C# 编写的客户端可以在相同的身份验证设置下正常工作:
CredentialCache myCache = new CredentialCache();
myCache.Add(new Uri(webs.Url), "NTLM",
new NetworkCredential("Administrator", "password", "server_domain"));
stub.Credentials = myCache;
【问题讨论】:
-
嗨@Vijay Mathew,你解决了吗?我正在开发一项新服务来进行 NTLM 身份验证nafiux.com/wasp 如果我可以帮助您,请告诉我
标签: java web-services iis axis2 axis