简体   繁体   English

HttpClient Commons-httpclient摘要认证

[英]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.

相关问题 Java commons-httpclient:测试超时值 - Java commons-httpclient: Testing timeout values 如何在commons-httpclient中强行断开连接? - How to force disconnection in commons-httpclient? commache-httpclient和httpclient之间的关系是什么,都来自apache - what the relationship between commons-httpclient and httpclient, both from apache Apache HttpClient 摘要身份验证 - Apache HttpClient Digest authentication 将查询参数添加到GetMethod(使用Java Commons-httpclient)? - Add query parameters to a GetMethod (using Java commons-httpclient)? 如何避免在 commons-httpclient 中调用 ChunkedInputStream.exhaustInputStream(this) - How to avoid calling ChunkedInputStream.exhaustInputStream(this) in commons-httpclient 使用commons-httpclient将新的httpclient-4.0.1 jar与项目一起使用 - Using the new httpclient-4.0.1 jar with a project using commons-httpclient Apache HttpClient摘要式身份验证失败 - Apache HttpClient Digest Authentication Failed 如何将查询参数添加到GetMethod(使用Java commons-httpclient)? - How do I add query parameters to a GetMethod (using Java commons-httpclient)? 将Java commons-httpclient与cacert,cert和从.pfx提取的密钥一起使用 - Use Java commons-httpclient with cacert, cert and key extracted from .pfx
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM