2016-07-04 9 views
0

DocuSignサードパーティを使用してPOCを実行しています。封筒を作成または送信中に、いくつかの問題に直面していますCreateEnvelopeを呼び出し、エラーメッセージCreateEnvelopeの呼び出しエラー

エラー取得しています:{ 「のerrorCode」:「PARTNER_AUTHENTICATION_FAILED」、 「メッセージ」:「指定されたインテグレータキーが見つからないか無効になっていませんでしたがインテグレータキーは指定されていませんでした。 }

セキュリティ上の理由から、メールIDまたはパスワードを入力していないため、以下のコードを認証できます。

private string DocLogin() 
{ 
    string accountId = null; 
    try 
    { 
     ApiClient apiClient = new ApiClient("https://demo.docusign.net/restapi"); 
     Configuration cfi = new Configuration(apiClient); 
     string authHeader = "{\"Username\":\"" + username + "\", \"Password\":\"" + password + "\", \"IntegratorKey\":\"" + integratorKey + "\"}"; 
     cfi.AddDefaultHeader("X-DocuSign-Authentication", authHeader); 
     AuthenticationApi authApi = new AuthenticationApi(cfi); 
     LoginInformation loginInfo = authApi.Login(); 
     accountId = loginInfo.LoginAccounts[0].AccountId; 
    } 
    catch (Exception ex) 
    { 
     string inner = ex.Message; 
    } 
    return accountId; 
} 

認証コードの後に​​accountidを取得しています。

private void CreateSendEnvelope(string accountID) 
{ 
    string pdfPath = Server.MapPath("~/PDF/pdf-sample.pdf"); 
    if (!string.IsNullOrEmpty(accountID)) 
    { 
     if (System.IO.File.Exists(pdfPath)) 
     { 
      byte[] fileBytes = System.IO.File.ReadAllBytes(pdfPath); 
      EnvelopeDefinition envDef = new EnvelopeDefinition(); 
      envDef.EmailSubject = "[DocuSign C# SDK] - Please sign this doc"; 
      Document doc = new Document(); 
      doc.DocumentBase64 = System.Convert.ToBase64String(fileBytes); 
      doc.Name = "img003.pdf"; 
      doc.DocumentId = "1"; 
      envDef.Documents = new List<Document>(); 
      envDef.Documents.Add(doc); 

      Signer signer = new Signer(); 
      signer.Email = "[email protected]"; 
      signer.Name = "Test"; 
      signer.RecipientId = "1"; 
      signer.Tabs = new Tabs(); 

      signer.Tabs.SignHereTabs = new List<SignHere>(); 
      SignHere signHere = new SignHere(); 
      signHere.DocumentId = "1"; 
      signHere.PageNumber = "1"; 
      signHere.RecipientId = "1"; 
      signHere.XPosition = "100"; 
      signHere.YPosition = "100"; 
      signer.Tabs.SignHereTabs.Add(signHere); 

      envDef.Recipients = new Recipients(); 
      envDef.Recipients.Signers = new List<Signer>(); 
      envDef.Recipients.Signers.Add(signer); 

      // set envelope status to "sent" to immediately send the signature request 
      envDef.Status = "sent"; 
      //envDef.Status = "created"; 

      // |EnvelopesApi| contains methods related to creating and sending Envelopes (aka signature requests) 
      EnvelopesApi envelopesApi = new EnvelopesApi(); 
      EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(accountID, envDef); 

      // print the JSON response 
      Console.WriteLine("EnvelopeSummary:\n{0}", JsonConvert.SerializeObject(envelopeSummary)); 

      //APIServiceSoapClient apiService = new APIServiceSoapClient(); 
      //return envelopeSummary; 
     } 
    } 
} 

上記のコードでは、上記のように例外が発生しています。これで私を助けてください。

答えて

1

CreateSendEnvelopeを呼び出す直前にDocLoginメソッドを呼び出していますか?エンベロープを作成する前にログインが切れている可能性があります。 CreateSendEnvelopeからloginメソッドを呼び出し、何が起こるかを見てください。

+0

これはスタンドアロンの回答ではなく、私のコメントによく似ています。 – Andrej

+0

私の評判のレベルのために他の人の質問にコメントすることはできません... –

+0

ええ、そうです、それは残念です。あなたはすぐに評判を得ることを願っています。 :) – Andrej

関連する問題