Exemplo n.º 1
0
    public APIServiceSoapClient CreateAPIProxy()
    {
        DocuSignSample.AccountCredentials creds = GetAPICredentials();
        APIServiceSoapClient apiClient = new APIServiceSoapClient("APIServiceSoap", creds.ApiUrl);
        apiClient.ClientCredentials.UserName.UserName = creds.UserName;
        apiClient.ClientCredentials.UserName.Password = creds.Password;

        return apiClient;
    }
Exemplo n.º 2
0
    public APIServiceSoapClient CreateAPIProxy()
    {
        DocuSignSample.AccountCredentials creds = GetAPICredentials();
        APIServiceSoapClient apiClient          = new APIServiceSoapClient("APIServiceSoap", creds.ApiUrl);

        apiClient.ClientCredentials.UserName.UserName = creds.UserName;
        apiClient.ClientCredentials.UserName.Password = creds.Password;

        return(apiClient);
    }
        public APIServiceSoapClient CreateAPIProxy()
        {
            var creds = GetAPICredentials();
            var apiClient = new APIServiceSoapClient(Keys.ApiServiceSoap, creds.ApiUrl);
            if (null != apiClient.ClientCredentials)
            {
                apiClient.ClientCredentials.UserName.UserName = creds.UserName;
                apiClient.ClientCredentials.UserName.Password = creds.Password;
            }

            return apiClient;
        }
Exemplo n.º 4
0
        public APIServiceSoapClient CreateAPIProxy()
        {
            var creds     = GetAPICredentials();
            var apiClient = new APIServiceSoapClient(Keys.ApiServiceSoap, creds.ApiUrl);

            if (null != apiClient.ClientCredentials)
            {
                apiClient.ClientCredentials.UserName.UserName = creds.UserName;
                apiClient.ClientCredentials.UserName.Password = creds.Password;
            }

            return(apiClient);
        }
        protected void CreateAndSend()
        {
            buttonTable.Visible = false;

            // Construct the envelope basics
            var envelope = new Envelope
            {
                Subject    = "DocuSign API SDK Example",
                EmailBlurb = "This envelope demonstrates embedded signing",
                AccountId  = Session[Keys.ApiAccountId].ToString(),
                Recipients = ConstructRecipients()
            };

            // Create the recipient(s)

            // Add the document to the envelope
            var stockDocument = new Document
            {
                PDFBytes      = Resources.DocuSign_Demo__111_PDF,
                Name          = "Demo Document",
                ID            = "1",
                FileExtension = "pdf"
            };

            envelope.Documents = new Document[] { stockDocument };

            // Add the tabs to the envelope
            envelope.Tabs = AddTabs(envelope.Recipients.Length);

            APIServiceSoapClient client = CreateAPIProxy();

            try
            {
                // Send the envelope and temporarily store the status in the session
                EnvelopeStatus status = client.CreateAndSendEnvelope(envelope);
                if (status.SentSpecified)
                {
                    Session[Keys.EnvelopeStatus] = status;
                    AddEnvelopeID(status.EnvelopeID);

                    // Start the first signer
                    SignFirst(status);
                }
            }
            catch (Exception ex)
            {
                GoToErrorPage(ex.Message);
            }
        }
        protected void SendNow(Envelope envelope)
        {
            APIServiceSoapClient client = CreateAPIProxy();

            try
            {
                // Create and send the envelope in one step
                EnvelopeStatus status = client.CreateAndSendEnvelope(envelope);

                // If we succeeded, go to the status
                if (status.SentSpecified)
                {
                    AddEnvelopeID(status.EnvelopeID);
                    Response.Redirect("GetStatusAndDocs.aspx", false);
                }
            }
            catch (Exception ex)
            {
                GoToErrorPage(ex.Message);
            }
        }
        protected void EmbedSending(Envelope envelope)
        {
            APIServiceSoapClient client = CreateAPIProxy();

            try
            {
                // Create the envelope (but don't send it!)
                EnvelopeStatus status = client.CreateEnvelope(envelope);
                AddEnvelopeID(status.EnvelopeID);

                // If it created successfully, redirect to the embedded host
                if (status.Status == EnvelopeStatusCode.Created)
                {
                    string navURL = String.Format("{0}?envelopeID={1}&accountID={2}&source=Document", "EmbeddedHost.aspx", status.EnvelopeID,
                                                  envelope.AccountId);
                    Response.Redirect(navURL, false);
                }
            }
            catch (Exception ex)
            {
                base.GoToErrorPage(ex.Message);
            }
        }
        public static APIServiceSoap CreateApiProxy(Account Identity, string password)
        {
#if true
            // the envelope is finally constructed we are ready to send it in
            AccountCredentials accountCredentials = new AccountCredentials();

            //If there are many accounts then the firet one is chosen for sending
            accountCredentials.AccountId = Identity.AccountID;
            accountCredentials.ApiUrl    = "https://demo.docusign.net/api/3.0/api.asmx";
            APIServiceSoapClient apiService = new APIServiceSoapClient("APIServiceSoap", accountCredentials.ApiUrl);
            apiService.ClientCredentials.UserName.UserName = Identity.UserID;
            apiService.ClientCredentials.UserName.Password = password;

            return(apiService);
#else       // this is a security token configuration
            // this is required for certain calls like RequestRecipientToken
            // you need to get a certificate from Thawte or VeriSign first and install it
            DocuSignWeb.APIServiceSoapClient apiService = new DocuSignWeb.APIServiceSoapClient("APIServiceSoap1", accountCredentials.ApiUrl);
            apiService.ClientCredentials.UserName.UserName = ConfigurationManager.AppSettings["APIUserName"];
            apiService.ClientCredentials.UserName.Password = ConfigurationManager.AppSettings["Password"];

            //
            // need to add the supporting token since DocuSign uses dual authentication for
            // for critical calls
            CustomBinding                   binding         = (CustomBinding)apiService.Endpoint.Binding;
            BindingElementCollection        elements        = binding.CreateBindingElements();
            SecurityBindingElement          security        = elements.Find <SecurityBindingElement>();
            UserNameSecurityTokenParameters tokenParameters = new UserNameSecurityTokenParameters();
            tokenParameters.InclusionMode      = SecurityTokenInclusionMode.AlwaysToRecipient;
            tokenParameters.RequireDerivedKeys = false;
            security.EndpointSupportingTokenParameters.SignedEncrypted.Add(
                tokenParameters);
            apiService.Endpoint.Binding = new CustomBinding(elements.ToArray());;
            return(apiService);
#endif
        }