0
甚至可能嗎?文件沒有說清楚。我嘗試了各種不同的機制來獲得身份驗證的工作,但我不斷得到一個「401:未經授權」的錯誤。這裏是我在哪裏:Axis2甚至可以使用BASIC認證
stub = new EngineStub();
HttpClient client = new HttpClient();
client.getParams().setAuthenticationPreemptive(true);
stub._getServiceClient().getServiceContext().getConfigurationContext().setProperty(HTTPConstants.CACHED_HTTP_CLIENT, client);
HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
List<String> authpref = new ArrayList<String>();
authpref.add(AuthPolicy.BASIC);
auth.setAuthSchemes(authpref);
auth.setUsername(username);
auth.setPassword(password);
auth.setPreemptiveAuthentication(true);
stub._getServiceClient().getOptions().setProperty(HTTPConstants.AUTHENTICATE, auth);
看一看這樣的: http://stackoverflow.com/questions/3283234/http-basic-authentication-in-java-using-httpclient – 2013-03-11 04:09:59
還共享安全如何配置這些網頁的細節-服務。 – 2013-03-11 04:11:09
關於此的文檔是無用的。整件事情都被打破了。 – Jacob 2013-03-11 05:30:57