'com.sun.jersey.api.client.ClientHandlerException when trying to make an Envelope on DocuSign API

That's my code, I'm trying to make an Embedded Sending within my app, I have got to this point deconstructing some code from the API usage examples (that in my opinion, could be better as it has a lot of code reusage that is good for a real aplication but awful for a showcase of possible usage). I know my code is full of worst practices but the objective now is to have just a working concept I will work on the code later.

ApiClient apiClient = new ApiClient(ApiClient.DEMO_REST_BASEPATH);
OAuthToken token = apiClient.generateAccessToken(
        "***", 
        "***", 
        code);
UserInfo userInfo = apiClient.getUserInfo(token.getAccessToken());
apiClient.setBasePath(userInfo.getAccounts().get(0).getBaseUri()+"/restapi");
apiClient.addDefaultHeader("Authorization", "Bearer " + token.getAccessToken());    

// Make the envelope
String accountId = userInfo.getAccounts().get(0).getAccountId();
EnvelopesApi envelopesApi = new EnvelopesApi(apiClient);
String filePath = "***";
EnvelopeDefinition env = makeEnvelope(filePath);
EnvelopeSummary results = envelopesApi.createEnvelope(accountId, env);
String envelopeId = results.getEnvelopeId();

// Create the sender view
// Set the URL where you want the recipient to go once they are done signing;
// this should typically be a callback route somewhere in your app
ReturnUrlRequest viewRequest = new ReturnUrlRequest();
viewRequest.setReturnUrl("***");
ViewUrl viewUrl = envelopesApi.createSenderView(accountId, envelopeId, viewRequest);

// Switch to Recipient and Documents view if requested by the user
String url = viewUrl.getUrl();

The error occurs when I call envelopesApi.createEnvelope(accountId, env), and I get a com.sun.jersey.api.client.ClientHandlerException. I don't really know how to troubleshoot this, as you may see in the logs below there is no error message whatsoever, and I can't find what I may have done wrong. I have revised my code to check if, on the process of acquiring the strips of code I needed from the Examples I have left something out, I have indeed corrected some slips in this process but the problem holds still. Note my app runs on java 8 so I'm using DocuSign API version 3.6.0, here is the log:

com.sun.jersey.api.client.ClientHandlerException
    at com.docusign.esign.client.auth.OAuth.updateAccessToken(OAuth.java:115)
    at com.docusign.esign.client.auth.OAuth.applyToParams(OAuth.java:103)
    at com.docusign.esign.client.ApiClient.updateParamsForAuth(ApiClient.java:1256)
    at com.docusign.esign.client.ApiClient.getAPIResponse(ApiClient.java:1139)
    at com.docusign.esign.client.ApiClient.invokeAPI(ApiClient.java:1205)
    at com.docusign.esign.api.EnvelopesApi.createEnvelope(EnvelopesApi.java:846)
    at com.docusign.esign.api.EnvelopesApi.createEnvelope(EnvelopesApi.java:787)
    at core.controle.arquivo.AtvEnviaEnvelope.execute(AtvEnviaEnvelope.java:60)
    ...
Caused by: java.lang.NullPointerException
    at com.docusign.esign.client.auth.OAuth.updateAccessToken(OAuth.java:113)
    ... 63 more


Solution 1:[1]

Please Open a case with DocuSign Developer Support through this link https://support.docusign.com/s/contactSupport?language=en_US and we will be happy to go through the issue with you.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Abdulrahman