如何调用 DocuSign 在生产环境中创建信封?

How Call DocuSign to create the envelope in production?

我正在尝试调用 DocuSign 以在生产环境中创建信封,但出现错误

 Error calling CreateEnvelope: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request - Invalid URL</h2>
<hr><p>HTTP Error 400. The request URL is invalid.</p>
</BODY></HTML>

调用信封的代码

    Dim accessToken = AccessToken1 ' Access token using JWT
    Dim basePath = BasePath1 ' https://eu.docusign.net/restapi
    Dim accountId = AccountId1 ' AccountId1 from production login
    Dim env As EnvelopeDefinition = MakeEnvelope(Signer, DocusignCcAddress, Buffer, FileName)
   
    Dim apiClient = New ApiClient(basePath)
    apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " & accessToken)
    Dim envelopesApi As EnvelopesApi = New EnvelopesApi(apiClient)
    Dim results As EnvelopeSummary = envelopesApi.CreateEnvelope(accountId, env) ' here i get that error
    Return results

当您将基本路径 URL 用作“https://docusign.net/restapi”时,出现此错误

Error calling CreateEnvelope: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

我使用以下代码成功获取访问令牌

        Dim apiClient = New ApiClient("https://eu.docusign.net/restapi")
        Dim ik As String = odjDTRep.Rows(0)("iss_Int_Key").ToString()
        Dim userId As String = odjDTRep.Rows(0)("sub1_Api_UserName").ToString()

        Dim authserver As String = odjDTRep.Rows(0)("aud").ToString()
        Dim rsaKey As String = System.IO.File.ReadAllText(Server.MapPath("") & "/Key/KMKey.key")


        Dim scopes = New List(Of String) From {
        "signature"
    }
        Dim authToken As OAuth.OAuthToken = apiClient.RequestJWTUserToken(ik, userId, authserver, Encoding.UTF8.GetBytes(rsaKey), 1, scopes)
        Dim accessToken As String = authToken.access_token

您需要为生产帐户设置 baseURL。并非所有客户都相同,因此您必须使用 getUserInformation() 命令检索它。

你也可以在 Apps and Keys page 上找到你的 baseURL,如果你去上面的话。