Example #1
0
    protected void getTemplates(object sender, EventArgs e)
    {
        String userName      = ConfigurationManager.AppSettings["API.Email"];
        String password      = ConfigurationManager.AppSettings["API.Password"];
        String integratorKey = ConfigurationManager.AppSettings["API.IntegratorKey"];
        String accountID     = ConfigurationManager.AppSettings["API.TemplatesAccountID"];

        try
        {
            ServiceReference1.DSAPIServiceSoapClient srv = new ServiceReference1.DSAPIServiceSoapClient();
            String auth = "<DocuSignCredentials><Username>" + userName
                          + "</Username><Password>" + password
                          + "</Password><IntegratorKey>" + integratorKey
                          + "</IntegratorKey></DocuSignCredentials>";


            using (OperationContextScope scope = new System.ServiceModel.OperationContextScope(srv.InnerChannel))
            {
                HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty();
                httpRequestProperty.Headers.Add("X-DocuSign-Authentication", auth);
                OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty;

                EnvelopeTemplateDefinition[] templates = srv.RequestTemplates(accountID, true);
                {
                    foreach (EnvelopeTemplateDefinition etd in templates)
                    {
                        templatesList.Items.Add(new ListItem(etd.Name, etd.TemplateID));
                    }
                }
            }
        }
        catch (Exception ex)
        {
            // Log4Net Piece
            log4net.ILog logger = log4net.LogManager.GetLogger(typeof(_Default));
            logger.Info("\n----------------------------------------\n");
            logger.Error(ex.Message);
            logger.Error(ex.StackTrace);
            Response.Write(ex.Message);
        }
        finally
        {
        }
    }
    protected void createEnvelope()
    {
        FileStream fs = null;

        try
        {
            String userName = ConfigurationManager.AppSettings["API.Email"];
            String password = ConfigurationManager.AppSettings["API.Password"];
            String integratorKey = ConfigurationManager.AppSettings["API.IntegratorKey"];


            String auth = "<DocuSignCredentials><Username>" + userName
                + "</Username><Password>" + password
                + "</Password><IntegratorKey>" + integratorKey
                + "</IntegratorKey></DocuSignCredentials>";
            ServiceReference1.DSAPIServiceSoapClient client = new ServiceReference1.DSAPIServiceSoapClient();

            using (OperationContextScope scope = new System.ServiceModel.OperationContextScope(client.InnerChannel))
            {
                HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty();
                httpRequestProperty.Headers.Add("X-DocuSign-Authentication", auth);
                OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty;

                CompositeTemplate template = new CompositeTemplate();

                // Set up the envelope
                EnvelopeInformation envInfo = new EnvelopeInformation();
                envInfo.AutoNavigation = true;
                envInfo.AccountId = ConfigurationManager.AppSettings["API.AccountId"];
                envInfo.Subject = "Dynamic Fields Example";

                // Set up recipients 
                Recipient[] recipients;
                if (jointEmail.Value.Trim().Equals(""))
                {
                    recipients = new Recipient[1];
                }
                else
                {
                    recipients = new Recipient[2];
                }

                recipients[0] = new Recipient();
                recipients[0].ID = "1";
                recipients[0].Email = email.Value;
                recipients[0].Type = RecipientTypeCode.Signer;
                recipients[0].UserName = firstname.Value + " " + lastname.Value;
                recipients[0].CaptiveInfo = new RecipientCaptiveInfo();

                recipients[0].CaptiveInfo.ClientUserId = RandomizeClientUserID();
                recipients[0].RoutingOrder = 1;
                recipients[0].RoleName = "Signer1";

                // If there is a 2nd recipient, configure 
                if (!jointEmail.Value.Equals(""))
                {
                    recipients[1] = new Recipient();
                    recipients[1].ID = "2";
                    recipients[1].Email = jointEmail.Value;
                    recipients[1].Type = RecipientTypeCode.Signer;
                    recipients[1].UserName = jointFirstname.Value + " " + jointLastname.Value;
                    recipients[1].RoleName = "Signer2";
                    recipients[1].RoutingOrder = 1;
                }

                //Configure the inline templates 
                InlineTemplate inlineTemplate = new InlineTemplate();
                inlineTemplate.Sequence = "1";
                inlineTemplate.Envelope = new Envelope();
                inlineTemplate.Envelope.Recipients = recipients;
                inlineTemplate.Envelope.AccountId = ConfigurationManager.AppSettings["API.AccountId"];

                // Initialize tab properties 
                Tab tab = new Tab();
                tab.Type = TabTypeCode.SignHere;
                tab.XPosition = xPosition.Value;
                tab.YPosition = yPosition.Value;
                tab.TabLabel = tabName.Value;
                tab.RecipientID = "1";
                tab.DocumentID = "1";
                tab.Name = tabName.Value;
                tab.PageNumber = tabPage.Value;

                Tab tab2 = new Tab();
                tab2.Type = TabTypeCode.DateSigned;

                tab2.XPosition = xPosition2.Value;
                tab2.YPosition = yPosition2.Value;
                tab2.TabLabel = tabName2.Value;
                tab2.RecipientID = "1";
                tab2.DocumentID = "1";
                tab2.Name = tabName2.Value;
                tab2.PageNumber = tabPage2.Value;

                inlineTemplate.Envelope.Tabs = new Tab[] { tab, tab2 };

                template.InlineTemplates = new InlineTemplate[] { inlineTemplate };


                // Configure the document
                template.Document = new Document();
                template.Document.ID = "1";
                template.Document.Name = "Sample Document";
                BinaryReader binReader = null;
                String filename = uploadFile.Value;
                if (File.Exists(Server.MapPath("~/App_Data/" + filename)))
                {
                    fs = new FileStream(Server.MapPath("~/App_Data/" + filename), FileMode.Open);
                    binReader = new BinaryReader(fs);
                }
                byte[] PDF = binReader.ReadBytes(System.Convert.ToInt32(fs.Length));
                template.Document.PDFBytes = PDF;

                template.Document.TransformPdfFields = true;
                template.Document.FileExtension = "pdf";

                //Create envelope with all the composite template information 
                EnvelopeStatus status = client.CreateEnvelopeFromTemplatesAndForms(envInfo, new CompositeTemplate[] { template }, true);
                RequestRecipientTokenAuthenticationAssertion assert = new RequestRecipientTokenAuthenticationAssertion();
                assert.AssertionID = "12345";
                assert.AuthenticationInstant = DateTime.Now;
                assert.AuthenticationMethod = RequestRecipientTokenAuthenticationAssertionAuthenticationMethod.Password;
                assert.SecurityDomain = "www.magicparadigm.com";

                RequestRecipientTokenClientURLs clientURLs = new RequestRecipientTokenClientURLs();

                clientURLs.OnAccessCodeFailed = ConfigurationManager.AppSettings["RecipientTokenClientURLsPrefix"] + "?envelopeId=" + status.EnvelopeID + "&event=OnAccessCodeFailed";
                clientURLs.OnCancel = ConfigurationManager.AppSettings["RecipientTokenClientURLsPrefix"] + "?envelopeId=" + status.EnvelopeID + "&event=OnCancel";
                clientURLs.OnDecline = ConfigurationManager.AppSettings["RecipientTokenClientURLsPrefix"] + "?envelopeId=" + status.EnvelopeID + "&event=OnDecline";
                clientURLs.OnException = ConfigurationManager.AppSettings["RecipientTokenClientURLsPrefix"] + "?envelopeId=" + status.EnvelopeID + "&event=OnException";
                clientURLs.OnFaxPending = ConfigurationManager.AppSettings["RecipientTokenClientURLsPrefix"] + "?envelopeId=" + status.EnvelopeID + "&event=OnFaxPending";
                clientURLs.OnIdCheckFailed = ConfigurationManager.AppSettings["RecipientTokenClientURLsPrefix"] + "?envelopeId=" + status.EnvelopeID + "&event=OnIdCheckFailed";
                clientURLs.OnSessionTimeout = ConfigurationManager.AppSettings["RecipientTokenClientURLsPrefix"] + "?envelopeId=" + status.EnvelopeID + "&event=OnSessionTimeout";
                clientURLs.OnTTLExpired = ConfigurationManager.AppSettings["RecipientTokenClientURLsPrefix"] + "?envelopeId=" + status.EnvelopeID + "&event=OnTTLExpired";
                clientURLs.OnViewingComplete = ConfigurationManager.AppSettings["RecipientTokenClientURLsPrefix"] + "?envelopeId=" + status.EnvelopeID + "&event=OnViewingComplete";


                String url = Request.Url.AbsoluteUri;

                String recipientToken;

                clientURLs.OnSigningComplete = url.Substring(0, url.LastIndexOf("/")) + "/EmbeddedSigningComplete0.aspx?envelopeID=" + status.EnvelopeID;
                recipientToken = client.RequestRecipientToken(status.EnvelopeID, recipients[0].CaptiveInfo.ClientUserId, recipients[0].UserName, recipients[0].Email, assert, clientURLs);
                Session["envelopeID"] = status.EnvelopeID;
                if (!Request.Browser.Browser.Equals("InternetExplorer") && (!Request.Browser.Browser.Equals("Safari")))
                {
                    docusignFrame.Visible = true;
                    docusignFrame.Src = recipientToken;
                }
                else // Handle IE differently since it does not allow dynamic setting of the iFrame width and height
                {
                    docusignFrameIE.Visible = true;
                    docusignFrameIE.Src = recipientToken;
                }


            }
        }
        catch (Exception ex)
        {
            // Log4Net Piece
            log4net.ILog logger = log4net.LogManager.GetLogger(typeof(DynamicFields));
            logger.Info("\n----------------------------------------\n");
            logger.Error(ex.Message);
            logger.Error(ex.StackTrace);
            Response.Write(ex.Message);

        }
        finally
        {
            if (fs != null)
                fs.Close();
        }
    }
    public void fillEnvelopeCustomFields()
    {
        String userName = ConfigurationManager.AppSettings["API.Email"];
        String password = ConfigurationManager.AppSettings["API.Password"];
        String integratorKey = ConfigurationManager.AppSettings["API.IntegratorKey"];


        String auth = "<DocuSignCredentials><Username>" + userName
            + "</Username><Password>" + password
            + "</Password><IntegratorKey>" + integratorKey
            + "</IntegratorKey></DocuSignCredentials>";

        try
        {
            ServiceReference1.DSAPIServiceSoapClient svc = new ServiceReference1.DSAPIServiceSoapClient();
            using (OperationContextScope scope = new System.ServiceModel.OperationContextScope(svc.InnerChannel))
            {
                HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty();
                httpRequestProperty.Headers.Add("X-DocuSign-Authentication", auth);
                OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty;

                if (Request.QueryString.Count > 0)
                {
                    if (!Request.QueryString["envelopeID"].Equals(""))
                    {
                        // Uncomment to see what happens with request/response call
//                        EnvelopeStatus envStatus = svc.RequestStatusWithDocumentFields(Request.QueryString["envelopeID"]);
                        String envelope = Request.QueryString["envelopeID"];
                        String connectMessage = GetEnvelopeData(envelope);
                        XmlDocument doc = new XmlDocument();
                        doc.LoadXml(connectMessage);

                        // Create an XmlNamespaceManager to resolve the default namespace.
                        XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
                        nsmgr.AddNamespace("ds", "http://www.docusign.net/API/3.0");

                        // Get the status of the envelope
                        XmlElement root = doc.DocumentElement;

                        // Get all the form data 
                        XmlNodeList tabs = root.SelectNodes("descendant::ds:EnvelopeStatus/ds:CustomFields/ds:CustomField", nsmgr);
                        XmlNode customFieldName;
                        XmlNode customFieldValue;

                        foreach (XmlNode tab in tabs)
                        {
                            customFieldName = tab.SelectSingleNode("descendant::ds:Name", nsmgr);
                            customFieldValue = tab.SelectSingleNode("descendant::ds:Value", nsmgr);
                            Response.Write("<tr>");
                            Response.Write("<td>");
                            Response.Write(customFieldName.InnerText);
                            Response.Write("</td>");
                            Response.Write("<td>");
                            Response.Write(customFieldValue.InnerText);
                            Response.Write("</td>");
                            Response.Write("</tr>");
                        }
                    }

                    
                }
            }
        }
        catch (Exception ex)
        {
            // Log4Net Piece
            log4net.ILog logger = log4net.LogManager.GetLogger(typeof(finance_ViewFormData));
            logger.Info("\n----------------------------------------\n");
            logger.Error(ex.Message);
            logger.Error(ex.StackTrace);
            Response.Write(ex.Message);

        }
        finally
        {

        }

    }
Example #4
0
    protected void createEnvelope()
    {
        FileStream fs = null;

        try
        {
            String userName      = ConfigurationManager.AppSettings["API.Email"];
            String password      = ConfigurationManager.AppSettings["API.Password"];
            String integratorKey = ConfigurationManager.AppSettings["API.IntegratorKey"];


            String auth = "<DocuSignCredentials><Username>" + userName
                          + "</Username><Password>" + password
                          + "</Password><IntegratorKey>" + integratorKey
                          + "</IntegratorKey></DocuSignCredentials>";
            ServiceReference1.DSAPIServiceSoapClient client = new ServiceReference1.DSAPIServiceSoapClient();

            using (OperationContextScope scope = new System.ServiceModel.OperationContextScope(client.InnerChannel))
            {
                HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty();
                httpRequestProperty.Headers.Add("X-DocuSign-Authentication", auth);
                OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty;

                CompositeTemplate template = new CompositeTemplate();

                // Set up recipients
                Recipient[] recipients;
                if (jointEmail.Value.Trim().Equals(""))
                {
                    recipients = new Recipient[1];
                }
                else
                {
                    recipients = new Recipient[2];
                }

                recipients[0]             = new Recipient();
                recipients[0].ID          = "1";
                recipients[0].Email       = email.Value;
                recipients[0].Type        = RecipientTypeCode.Signer;
                recipients[0].UserName    = firstname.Value + " " + lastname.Value;
                recipients[0].CaptiveInfo = new RecipientCaptiveInfo();

                recipients[0].CaptiveInfo.ClientUserId = RandomizeClientUserID();
                recipients[0].RoutingOrder             = 1;
                recipients[0].RoleName = "Signer1";

                // If there is a 2nd recipient, configure
                if (!jointEmail.Value.Equals(""))
                {
                    recipients[1]              = new Recipient();
                    recipients[1].ID           = "2";
                    recipients[1].Email        = jointEmail.Value;
                    recipients[1].Type         = RecipientTypeCode.Signer;
                    recipients[1].UserName     = jointFirstname.Value + " " + jointLastname.Value;
                    recipients[1].RoleName     = "Signer2";
                    recipients[1].RoutingOrder = 1;
                }

                //Configure the inline templates
                InlineTemplate inlineTemplate = new InlineTemplate();
                inlineTemplate.Sequence            = "2";
                inlineTemplate.Envelope            = new Envelope();
                inlineTemplate.Envelope.Recipients = recipients;
                inlineTemplate.Envelope.AccountId  = ConfigurationManager.AppSettings["API.TemplatesAccountId"];

                template.InlineTemplates = new InlineTemplate[] { inlineTemplate };
                // Configure the document
                template.Document      = new Document();
                template.Document.ID   = "1";
                template.Document.Name = "Sample Document";

                BinaryReader binReader = null;
                String       filename  = uploadFile.Value;
                if (File.Exists(Server.MapPath("~/App_Data/" + filename)))
                {
                    fs        = new FileStream(Server.MapPath("~/App_Data/" + filename), FileMode.Open);
                    binReader = new BinaryReader(fs);
                }
                byte[] PDF = binReader.ReadBytes(System.Convert.ToInt32(fs.Length));
                template.Document.PDFBytes = PDF;

                template.Document.TransformPdfFields = true;
                template.Document.FileExtension      = "pdf";

                ServerTemplate serverTemplate = new ServerTemplate();

                serverTemplate.Sequence   = "1";
                serverTemplate.TemplateID = templatesList.SelectedValue;
                template.ServerTemplates  = new ServerTemplate[] { serverTemplate };

                // Set up the envelope
                EnvelopeInformation envInfo = new EnvelopeInformation();
                envInfo.AutoNavigation = true;
                envInfo.AccountId      = ConfigurationManager.AppSettings["API.AccountId"];
                envInfo.Subject        = "Templates Example";

                //Create envelope with all the composite template information
                EnvelopeStatus status = client.CreateEnvelopeFromTemplatesAndForms(envInfo, new CompositeTemplate[] { template }, true);
                RequestRecipientTokenAuthenticationAssertion assert = new RequestRecipientTokenAuthenticationAssertion();
                assert.AssertionID           = "12345";
                assert.AuthenticationInstant = DateTime.Now;
                assert.AuthenticationMethod  = RequestRecipientTokenAuthenticationAssertionAuthenticationMethod.Password;
                assert.SecurityDomain        = "www.magicparadigm.com";

                RequestRecipientTokenClientURLs clientURLs = new RequestRecipientTokenClientURLs();

                clientURLs.OnAccessCodeFailed = ConfigurationManager.AppSettings["RecipientTokenClientURLsPrefix"] + "?envelopeId=" + status.EnvelopeID + "&event=OnAccessCodeFailed";
                clientURLs.OnCancel           = ConfigurationManager.AppSettings["RecipientTokenClientURLsPrefix"] + "?envelopeId=" + status.EnvelopeID + "&event=OnCancel";
                clientURLs.OnDecline          = ConfigurationManager.AppSettings["RecipientTokenClientURLsPrefix"] + "?envelopeId=" + status.EnvelopeID + "&event=OnDecline";
                clientURLs.OnException        = ConfigurationManager.AppSettings["RecipientTokenClientURLsPrefix"] + "?envelopeId=" + status.EnvelopeID + "&event=OnException";
                clientURLs.OnFaxPending       = ConfigurationManager.AppSettings["RecipientTokenClientURLsPrefix"] + "?envelopeId=" + status.EnvelopeID + "&event=OnFaxPending";
                clientURLs.OnIdCheckFailed    = ConfigurationManager.AppSettings["RecipientTokenClientURLsPrefix"] + "?envelopeId=" + status.EnvelopeID + "&event=OnIdCheckFailed";
                clientURLs.OnSessionTimeout   = ConfigurationManager.AppSettings["RecipientTokenClientURLsPrefix"] + "?envelopeId=" + status.EnvelopeID + "&event=OnSessionTimeout";
                clientURLs.OnTTLExpired       = ConfigurationManager.AppSettings["RecipientTokenClientURLsPrefix"] + "?envelopeId=" + status.EnvelopeID + "&event=OnTTLExpired";
                clientURLs.OnViewingComplete  = ConfigurationManager.AppSettings["RecipientTokenClientURLsPrefix"] + "?envelopeId=" + status.EnvelopeID + "&event=OnViewingComplete";


                String url = Request.Url.AbsoluteUri;

                String recipientToken;

                clientURLs.OnSigningComplete = url.Substring(0, url.LastIndexOf("/")) + "/EmbeddedSigningComplete0.aspx?envelopeID=" + status.EnvelopeID;
                recipientToken        = client.RequestRecipientToken(status.EnvelopeID, recipients[0].CaptiveInfo.ClientUserId, recipients[0].UserName, recipients[0].Email, assert, clientURLs);
                Session["envelopeID"] = status.EnvelopeID;
                if (!Request.Browser.Browser.Equals("InternetExplorer") && (!Request.Browser.Browser.Equals("Safari")))
                {
                    docusignFrame.Visible = true;
                    docusignFrame.Src     = recipientToken;
                }
                else // Handle IE differently since it does not allow dynamic setting of the iFrame width and height
                {
                    docusignFrameIE.Visible = true;
                    docusignFrameIE.Src     = recipientToken;
                }
            }
        }
        catch (Exception ex)
        {
            // Log4Net Piece
            log4net.ILog logger = log4net.LogManager.GetLogger(typeof(_Default));
            logger.Info("\n----------------------------------------\n");
            logger.Error(ex.Message);
            logger.Error(ex.StackTrace);
            Response.Write(ex.Message);
        }
        finally
        {
            if (fs != null)
            {
                fs.Close();
            }
        }
    }
    public void fillFieldData()
    {
        String userName = ConfigurationManager.AppSettings["API.Email"];
        String password = ConfigurationManager.AppSettings["API.Password"];
        String integratorKey = ConfigurationManager.AppSettings["API.IntegratorKey"];

        String auth = "<DocuSignCredentials><Username>" + userName
            + "</Username><Password>" + password
            + "</Password><IntegratorKey>" + integratorKey
            + "</IntegratorKey></DocuSignCredentials>";

        try
        {
            ServiceReference1.DSAPIServiceSoapClient svc = new ServiceReference1.DSAPIServiceSoapClient();
            using (OperationContextScope scope = new System.ServiceModel.OperationContextScope(svc.InnerChannel))
            {
                HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty();
                httpRequestProperty.Headers.Add("X-DocuSign-Authentication", auth);
                OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty;


                        String envelope = Request.QueryString["envelopeID"];
                        //String connectMessage = GetEnvelopeData(envelope);
                        XmlDocument doc = new XmlDocument();
                        //doc.LoadXml(connectMessage);
                        doc.Load("c:\\temp\\connectmessage.xml");


                        // Create an XmlNamespaceManager to resolve the default namespace.
                        XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
                        nsmgr.AddNamespace("ds", "http://www.docusign.net/API/3.0");

                        // Get the status of the envelope
                        XmlElement root = doc.DocumentElement;

                        // Get all the form data 
//                        XmlNodeList documentFields = root.SelectNodes("descendant::ds:EnvelopeStatus/ds:DocumentStatuses/ds:DocumentStatus/DocumentFields", nsmgr);
                        XmlNodeList documentFields = root.SelectNodes("descendant::ds:EnvelopeStatus/ds:DocumentStatuses/ds:DocumentStatus/ds:DocumentFields", nsmgr);
                        XmlNode documentFieldName;
                        XmlNode documentFieldValue;

                        foreach (XmlNode documentField in documentFields)
                        {
                            documentFieldName = documentField.SelectSingleNode("descendant::ds:Name", nsmgr);
                            documentFieldValue = documentField.SelectSingleNode("descendant::ds:Value", nsmgr);
                            Response.Write("<tr>");
                            Response.Write("<td>");
                            if (documentFieldName != null)
                                Response.Write(documentFieldName.InnerText);
                            Response.Write("</td>");
                            Response.Write("<td>");
                            if (documentFieldValue != null)
                                Response.Write(documentFieldValue.InnerText);
                            Response.Write("</td>");
                            Response.Write("</tr>");
                        }
                    }

        }
        catch (Exception ex)
        {
            // Log4Net Piece
            log4net.ILog logger = log4net.LogManager.GetLogger(typeof(demos_ParseXML));
            logger.Info("\n----------------------------------------\n");
            logger.Error(ex.Message);
            logger.Error(ex.StackTrace);
            Response.Write(ex.Message);

        }
        finally
        {

        }

    }
    protected void getTemplates(object sender, EventArgs e)
    {
        String userName = ConfigurationManager.AppSettings["API.Email"];
        String password = ConfigurationManager.AppSettings["API.Password"];
        String integratorKey = ConfigurationManager.AppSettings["API.IntegratorKey"];
        String accountID = ConfigurationManager.AppSettings["API.AccountID"];

        try
        {
            ServiceReference1.DSAPIServiceSoapClient srv = new ServiceReference1.DSAPIServiceSoapClient();
            String auth = "<DocuSignCredentials><Username>" + userName
                + "</Username><Password>" + password
                + "</Password><IntegratorKey>" + integratorKey
                + "</IntegratorKey></DocuSignCredentials>";


            using (OperationContextScope scope = new System.ServiceModel.OperationContextScope(srv.InnerChannel))
            {
                HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty();
                httpRequestProperty.Headers.Add("X-DocuSign-Authentication", auth);
                OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty;

                EnvelopeTemplateDefinition[] templates = srv.RequestTemplates(accountID, true);
                {

                    foreach (EnvelopeTemplateDefinition etd in templates)
                    {
                        templatesList.Items.Add(new ListItem(etd.Name, etd.TemplateID));

                    }
                }
            }
        }
        catch (Exception ex)
        {
            // Log4Net Piece
            log4net.ILog logger = log4net.LogManager.GetLogger(typeof(_Default));
            logger.Info("\n----------------------------------------\n");
            logger.Error(ex.Message);
            logger.Error(ex.StackTrace);
            Response.Write(ex.Message);

        }
        finally
        {
        }

    }
Example #7
0
    public void fillFieldData()
    {
        String userName      = ConfigurationManager.AppSettings["API.Email"];
        String password      = ConfigurationManager.AppSettings["API.Password"];
        String integratorKey = ConfigurationManager.AppSettings["API.IntegratorKey"];

        String auth = "<DocuSignCredentials><Username>" + userName
                      + "</Username><Password>" + password
                      + "</Password><IntegratorKey>" + integratorKey
                      + "</IntegratorKey></DocuSignCredentials>";

        try
        {
            ServiceReference1.DSAPIServiceSoapClient svc = new ServiceReference1.DSAPIServiceSoapClient();
            using (OperationContextScope scope = new System.ServiceModel.OperationContextScope(svc.InnerChannel))
            {
                HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty();
                httpRequestProperty.Headers.Add("X-DocuSign-Authentication", auth);
                OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty;

                if (Request.QueryString.Count > 0)
                {
                    if (!Request.QueryString["envelopeID"].Equals(""))
                    {
                        String      envelope       = Request.QueryString["envelopeID"];
                        String      connectMessage = GetEnvelopeData(envelope);
                        XmlDocument doc            = new XmlDocument();
                        doc.LoadXml(connectMessage);

                        // Create an XmlNamespaceManager to resolve the default namespace.
                        XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
                        nsmgr.AddNamespace("ds", "http://www.docusign.net/API/3.0");

                        // Get the status of the envelope
                        XmlElement root = doc.DocumentElement;

                        // Get all the form data
                        XmlNodeList documentFields = root.SelectNodes("descendant::ds:EnvelopeStatus/ds:DocumentStatuses/ds:DocumentStatus/ds:DocumentFields", nsmgr);
                        XmlNode     documentFieldName;
                        XmlNode     documentFieldValue;

                        foreach (XmlNode documentField in documentFields)
                        {
                            documentFieldName  = documentField.SelectSingleNode("descendant::ds:Name", nsmgr);
                            documentFieldValue = documentField.SelectSingleNode("descendant::ds:Value", nsmgr);
                            Response.Write("<tr>");
                            Response.Write("<td>");
                            if (documentFieldName != null)
                            {
                                Response.Write(documentFieldName.InnerText);
                            }
                            Response.Write("</td>");
                            Response.Write("<td>");
                            if (documentFieldValue != null)
                            {
                                Response.Write(documentFieldValue.InnerText);
                            }
                            Response.Write("</td>");
                            Response.Write("</tr>");
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
            // Log4Net Piece
            log4net.ILog logger = log4net.LogManager.GetLogger(typeof(finance_ViewFormData));
            logger.Info("\n----------------------------------------\n");
            logger.Error(ex.Message);
            logger.Error(ex.StackTrace);
            Response.Write(ex.Message);
        }
        finally
        {
        }
    }