Docusign Credential API中的代理

时间:2015-07-20 19:40:27

标签: soap docusignapi soap-client

遵循Docusign SDK的示例 https://github.com/docusign/DocuSign-SOAP-SDK

尝试实现Credential API,代码如下所示

public LoginResult getCredentialAPI() {
        CredentialSoap credApi = new CredentialFactory().getCredential(credentialURL);

        LoginResult result = credApi.login("[" + integratorKey + "]" + username, password, true);

        return result;

    }

我收到连接时间错误,原因是我必须使用代理连接设置来建立连接,我在哪里添加服务器URL和端口以进行代理连接。下面列出了Credential Factory类

public class CredentialFactory {

    /**
     * Builds the API interface in order to use the Docusign Credential API.
     *
     * @param webserviceEndpoint the endpoint for the credential webservice
     * @return the credential api stub
     */
    public CredentialSoap getCredential(String webserviceEndpoint) {
        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();

        setupService(factory, webserviceEndpoint);

        CredentialSoap credentialProxy = (CredentialSoap) factory.create();

        return credentialProxy;
    }

    /**
     * Set service class and webservice url.
     *
     * @param factory
     * @param webserviceEndpoint the endpoint for the credential webservice
     */
    protected void setupService(JaxWsProxyFactoryBean factory, String webserviceEndpoint) {
        factory.setServiceClass(CredentialSoap.class);
        factory.setAddress(webserviceEndpoint);
    }
}

1 个答案:

答案 0 :(得分:2)

代理设置依赖于堆栈。因此,设置通常低于SOAP调用的级别。您使用的是什么堆栈?

从您的变量名称判断,您正在使用JAX-WS。在那种情况下,请参阅 https://stackoverflow.com/a/6447240/64904