[英]HttpClient commons-httpclient Digest Authentication
I am getting this error from a PostMethod using commons-httpclient 我从使用commons-httpclient的PostMethod获取此错误
No credentials available for DIGEST 'realm'@localhost 没有可用于DIGEST'realm'@ localhost的凭据
and a 401 back from the server. 然后从服务器返回401。
I followed the example from this post java client program to send digest authentication request using HttpClient API (2) 我遵循了此后的Java客户端程序中的示例,以使用HttpClient API发送摘要身份验证请求(2)
However, it still seems to fail. 但是,它似乎仍然失败。
I am trying to connect to a XML-RPC service, we use digest authentication. 我正在尝试连接到XML-RPC服务,我们使用摘要身份验证。 I tried using the Apache xmlrpc library but it seems to not support digest authentication.
我尝试使用Apache xmlrpc库,但它似乎不支持摘要身份验证。
Any ideas? 有任何想法吗?
Thanks. 谢谢。
I'm trying to do the exact same thing. 我正在尝试做完全相同的事情。 I have my XML-RPC client working fine now:
我的XML-RPC客户端现在可以正常工作了:
public static short connectToBugTrackingXmlRpcServer() {
try {
XmlRpcClientConfigImpl xmlRpcClientConfig = new XmlRpcClientConfigImpl();
xmlRpcClientConfig.setServerURL(new URL(CStudioGlobals.bugTrackingConfProperties.getUrlXmlRpcServer()));
xmlRpcClientConfig.setBasicUserName(CStudioGlobals.bugTrackingConfProperties.getUsername());
xmlRpcClientConfig.setBasicPassword(CStudioGlobals.bugTrackingConfProperties.getPassword());
xmlRpcClientConfig.setEncoding("UTF-8");
XmlRpcClient xmlRpcClient = new XmlRpcClient();
xmlRpcClient.setConfig(xmlRpcClientConfig);
CTrackerDynamicProxy xmlRpcProxy = new CTrackerDynamicProxy(xmlRpcClient);
Ticket ticket = (Ticket)xmlRpcProxy.newInstance(Ticket.class);
ticket.query(); // query some tickets
return CONNECTION_SUCCESS;
} catch (Throwable t) {
t.printStackTrace();
displayError(CStudioGlobals.localization.getTerm("error.title.Sql_error"),
CStudioGlobals.localization.getTerm("error.content._Invalid_connection"),
CStudioGlobals.localization.getTerm("error.resolution.Check_your_connection_settings"));
return CONNECTION_RETRY;
}
}
but I'd like to use http digest authentication. 但我想使用http摘要认证。 Could you explain ho you did it ?
您能解释一下您这样做了吗? Thanks,
谢谢,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.