2015-07-20 22 views
0

繼位於 https://github.com/docusign/DocuSign-SOAP-SDK代理中的DocuSign憑據API

試圖實施憑證API的DocuSign SDK的例子,代碼的東西下面

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); 
    } 
} 

回答

2

代理設置是依賴於堆棧的。所以這個設置通常低於SOAP調用的級別。你使用什麼堆棧?

從您的變量名稱判斷,您正在使用JAX-WS。在這種情況下,請參閱 https://stackoverflow.com/a/6447240/64904