Docusign与MVC 5 Web应用程序集成

时间:2015-05-21 13:58:15

标签: asp.net-mvc-5 docusignapi

我们正在尝试将docusign(嵌入式签名/嵌入式docusign控制台,以决定哪一个)与现有的MVC 5 Web应用程序集成。我正在寻找一个起点,并遇到了你的问题。我查看了API演练(7,8,9),但我想知道如何开始。例如,我们需要将用户引导至申请表,以便他们在网站上注册后填写并签名。签名后我想将它们重定向回网站。

非常感谢任何指针或示例。

非常感谢,Sunny

下面是我的代码 - 一直工作到最后一个firday(但从昨天我得到这个错误 - " 406 - 客户端浏览器不接受所请求页面的MIME类型。 您要查找的页面无法通过浏览器打开,因为它具有 您的浏览器不接受的文件扩展名。"

    protected const string IntegratorKey = "XXX-XXX";
    protected const string Environment = "http://demo.docusign.net";
    static void Main(string[] args)
    {
        // Example #1...
        Console.WriteLine("Testing Walkthrough #7...");

        // configure application's integrator key, webservice url, and rest api version
        RestSettings.Instance.IntegratorKey = IntegratorKey;
        RestSettings.Instance.DocuSignAddress = Environment;
        RestSettings.Instance.WebServiceUrl = Environment + "/restapi/v2";

        docusign test = new docusign();
        test.EmbeddedSigning();
        Console.ReadLine(); // pause to show console output
    }

    private void EmbeddedSigning()
    {
        //*****************************************************************
        // ENTER VALUES FOR FOLLOWING VARIABLES!
        //*****************************************************************
        string AccountEmail = "s@something.com";
        string AccountPassword = "*****";
        string EnvelopeId = "xxxxxxx";              
        string RecipientEmail = "s@someone.com";
        string RecipientName = "someone";
        //*****************************************************************

        // user credentials 
        Account account = new Account();
        account.Email = AccountEmail;
        account.Password = AccountPassword;

        // make the login call (retrieves your baseUrl and accountId)
        bool result = account.Login();
        if (!result)
        {
            Console.WriteLine("Login API call failed for user {0}.\nError Code:  {1}\nMessage:  {2}", account.Email, account.RestError.errorCode, account.RestError.message);
            return;
        }

        // create envelope object and assign login info
        Envelope envelope = new Envelope();           
        envelope.Login = account;           
        // assign the envelope id that was passed in
        envelope.EnvelopeId = EnvelopeId;
        //add one signer (single recipient embedded signing currently supported in DocuSign .NET Client)
        envelope.Recipients = new Recipients()
        {
            signers = new Signer[]
            {
                new Signer()
                {
                    email = RecipientEmail,
                    name = RecipientName,
                    recipientId = "1",
                    clientUserId = "1"
                }
            }
        };            

        try
        {
            result = envelope.GetRecipientView("http://example.com/");
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }           
        Console.WriteLine(envelope.SenderViewUrl);

        Console.ReadLine();

        if (!result)
        {
            if (envelope.RestError != null)
            {
                Console.WriteLine("Error code:  {0}\nMessage:  {1}", envelope.RestError.errorCode, envelope.RestError.message);
                Console.ReadLine();
                return;
            }
            else
            {
                Console.WriteLine("Error encountered retrieving signing token, please review your envelope and recipient data.");
                return;
            }
        }
        else
        {
            // open the recipient view (SenderViewUrl field is re-used for the recipient URL)
            Process.Start(envelope.SenderViewUrl);
        }
    }

1 个答案:

答案 0 :(得分:2)

嵌入式签名

嵌入式签名使用returnUrl参数完全符合您的要求。这也允许签名者在不注册DocuSign帐户的情况下签名,以简化流程。

查看DocuSign的 Embedded Signing REST API Walkthrough