GetEmbeddedSignerView badrequest docusing api

时间:2015-04-19 22:10:58

标签: c# api nuget docusignapi

我正在尝试从docusign nuget包中调用emmbeddedSignerView方法,但响应无法返回url。我最终复制了单元测试代码

// create a new envelope with 2 recipients            
        var envelope = new Envelope { Login = account };
        byte[] doc1 = { 36, 45, 34, 67, 121, 87, 99, 32, 32, 32, 54, 54, 55, 56, 32 };
        var signers = new List<Signer>();
        // note we need to specify clientUserId
        signers.Add(new Signer { email = "unitests1@testing.com", name = "test1", recipientId = "1", routingOrder = "1", clientUserId = "1" });
        //signers.Add(new Signer { email = "unitests2@testing.com", name = "test2", recipientId = "2", routingOrder = "2", clientUserId = "2" });
        envelope.Recipients = new Recipients { signers = signers.ToArray() };
        envelope.Create(doc1, "test-self-signed.doc");

        // send it
        envelope.Status = "sent";
        envelope.UpdateStatus();

        // get embedded signing views for 2 recipients
        string urlForfirstSigner = envelope.GetEmbeddedSignerView("www.docusign.com", signers.First());

当我调试时,我可以看到响应状态代码是&#34; BadRequest&#34;使用响应文本&#34; RECIPIENT_NOT_IN_SEQUENCE \&#34;,\ r \ n \&#34; message \&#34;:\&#34;无法生成无序收件人的令牌。&# 34;

我做错了吗?我想,因为我复制了代码它应该工作...

我正在使用nuget包,所以我复制了我的创建和嵌入式签名请求和响应的对象数据,希望这会有所帮助。

REQUEST
{System.Net.HttpWebRequest}
    base: {System.Net.HttpWebRequest}
    Accept: null
    Address: {https://demo.docusign.net/restapi/v2/accounts/991023/envelopes?api_password=true}
    AllowAutoRedirect: true
    AllowReadStreamBuffering: false
    AllowWriteStreamBuffering: true
    AutomaticDecompression: None
    ClientCertificates: {System.Security.Cryptography.X509Certificates.X509CertificateCollection}
    Connection: null
    ConnectionGroupName: null
    ContentLength: 512
    ContentType: "multipart/form-data; boundary=00000000-0000-0000-0000-000000000000"
    ContinueDelegate: null
    ContinueTimeout: 350
    CookieContainer: null
    Credentials: null
    Date: {1/1/0001 12:00:00 AM}
    Expect: null
    HaveResponse: false
    Headers: {X-DocuSign-Authentication: <DocuSignCredentials><Username>qfroth@gmail.com</Username><Password>MYPASSWORD</Password><IntegratorKey>MYINTEGRATORKEY</IntegratorKey></DocuSignCredentials>
Content-Type: multipart/form-data; boundary=00000000-0000-0000-0000-000000000000
Host: demo.docusign.net

}
    Host: "demo.docusign.net"
    IfModifiedSince: {1/1/0001 12:00:00 AM}
    KeepAlive: true
    MaximumAutomaticRedirections: 50
    MaximumResponseHeadersLength: 64
    MediaType: null
    Method: "POST"
    Pipelined: true
    PreAuthenticate: false
    ProtocolVersion: {1.1}
    Proxy: null
    ReadWriteTimeout: 300000
    Referer: null
    RequestUri: {https://demo.docusign.net/restapi/v2/accounts/991023/envelopes?api_password=true}
    SendChunked: false
    ServerCertificateValidationCallback: null
    ServicePoint: {System.Net.ServicePoint}
    SupportsCookieContainer: true
    Timeout: 100000
    TransferEncoding: null
    UnsafeAuthenticatedConnectionSharing: false
    UseDefaultCredentials: false
    UserAgent: null



RESPONSE

{DocuSign.Integrations.Client.ResponseInfo}
    ContentType: "application/json; charset=utf-8"
    ErrorMessage: ""
    ResponseBytes: {byte[198]}
    ResponseStream: {System.Net.ConnectStream}
    ResponseText: "{\r\n  \"envelopeId\": \"b3c02285-f787-49b4-951d-53bb4057023e\",\r\n  \"uri\": \"/envelopes/b3c02285-f787-49b4-951d-53bb4057023e\",\r\n  \"statusDateTime\": \"2015-04-22T04:26:41.7770000Z\",\r\n  \"status\": \"created\"\r\n}"
    StatusCode: Created


REQUEST
{System.Net.HttpWebRequest}
    base: {System.Net.HttpWebRequest}
    Accept: "application/json"
    Address: {https://demo.docusign.net/restapi/v2/accounts/991023/envelopes/b3c02285-f787-49b4-951d-53bb4057023e/views/recipient}
    AllowAutoRedirect: true
    AllowReadStreamBuffering: false
    AllowWriteStreamBuffering: true
    AutomaticDecompression: None
    ClientCertificates: {System.Security.Cryptography.X509Certificates.X509CertificateCollection}
    Connection: null
    ConnectionGroupName: null
    ContentLength: 133
    ContentType: "application/json"
    ContinueDelegate: null
    ContinueTimeout: 350
    CookieContainer: null
    Credentials: null
    Date: {1/1/0001 12:00:00 AM}
    Expect: null
    HaveResponse: false
    Headers: {Accept: application/json
Content-Type: application/json
X-DocuSign-Authentication: <DocuSignCredentials><Username>qfroth@gmail.com</Username><Password>MYPASSWORD</Password><IntegratorKey>MYINTEGRATORKEY</IntegratorKey></DocuSignCredentials>
Host: demo.docusign.net

}
    Host: "demo.docusign.net"
    IfModifiedSince: {1/1/0001 12:00:00 AM}
    KeepAlive: true
    MaximumAutomaticRedirections: 50
    MaximumResponseHeadersLength: 64
    MediaType: null
    Method: "POST"
    Pipelined: true
    PreAuthenticate: false
    ProtocolVersion: {1.1}
    Proxy: null
    ReadWriteTimeout: 300000
    Referer: null
    RequestUri: {https://demo.docusign.net/restapi/v2/accounts/991023/envelopes/b3c02285-f787-49b4-951d-53bb4057023e/views/recipient}
    SendChunked: false
    ServerCertificateValidationCallback: null
    ServicePoint: {System.Net.ServicePoint}
    SupportsCookieContainer: true
    Timeout: 100000
    TransferEncoding: null
    UnsafeAuthenticatedConnectionSharing: false
    UseDefaultCredentials: false
    UserAgent: null

RESPONSE
{DocuSign.Integrations.Client.ResponseInfo}
    ContentType: "application/json; charset=utf-8"
    ErrorMessage: "Bad Request"
    ResponseBytes: null
    ResponseStream: null
    ResponseText: "{\r\n  \"errorCode\": \"RECIPIENT_NOT_IN_SEQUENCE\",\r\n  \"message\": \"The token for an out of sequence recipient cannot be generated.\"\r\n}"
    StatusCode: BadRequest

0 个答案:

没有答案