Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(DataFlex) Send DocuSign XML RequestDemonstrates how to send a DocuSign XML request. Important:This example requires Chillkat v9.5.0.75 or greater.
Use ChilkatAx-win32.pkg Procedure Test Variant vReq Handle hoReq Handle hoXmlCred Handle hoXml Boolean iSuccess Handle hoHttp Variant vResp Handle hoResp String sEnvelopeId String sStatus String sStatusDateTime String sUri String sTemp1 Integer iTemp1 Boolean bTemp1 // This requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. Get Create (RefClass(cComChilkatHttpRequest)) To hoReq If (Not(IsComObjectCreated(hoReq))) Begin Send CreateComObject of hoReq End Set ComHttpVerb Of hoReq To "POST" // Replace "12999999" with your own account number. (12999999 is a ficticious account number) Set ComPath Of hoReq To "/restapi/v2/accounts/12999999/envelopes" Send ComAddHeader To hoReq "Accept" "application/xml" // Don't worry about the boundary string. Chilkat will automatically generate one and include it. Set ComContentType Of hoReq To "multipart/form-data" Get Create (RefClass(cComChilkatXml)) To hoXmlCred If (Not(IsComObjectCreated(hoXmlCred))) Begin Send CreateComObject of hoXmlCred End Set ComTag Of hoXmlCred To "DocuSignCredentials" Send ComUpdateChildContent To hoXmlCred "Username" "YOUR_DOCUSIGN_USERNAME" Send ComUpdateChildContent To hoXmlCred "Password" "YOUR_DOCUSIGN_PASSWORD" Send ComUpdateChildContent To hoXmlCred "IntegratorKey" "ABCD-12345678-1234-AAAA-BBBB-abcdabcdabcd" Set ComEmitXmlDecl Of hoXmlCred To False Set ComEmitCompact Of hoXmlCred To True Get ComGetXml Of hoXmlCred To sTemp1 Send ComAddHeader To hoReq "X-DocuSign-Authentication" sTemp1 // Don't worry about Host or Content-Length headers, Chilkat automatically adds them... // Build the XML for the 1st body part.. Get Create (RefClass(cComChilkatXml)) To hoXml If (Not(IsComObjectCreated(hoXml))) Begin Send CreateComObject of hoXml End Set ComTag Of hoXml To "envelopeDefinition" Get ComAddAttribute Of hoXml "xmlns" "http://www.docusign.com/restapi" To iSuccess Send ComUpdateChildContent To hoXml "emailSubject" "Signature Request: Test Test:001019:033611" Send ComUpdateChildContent To hoXml "status" "sent" Send ComUpdateChildContent To hoXml "documents|document|documentId" "1" Send ComUpdateChildContent To hoXml "documents|document|name" "001019_TestTest_RetailDeals_163357" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|hostEmail" "admin@chilkatsoft.com" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|hostName" "Chilkat Admin" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|signerName" "Test Test" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|recipientId" "1" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|routingOrder" "1" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|signerEmail" "test@tyest.com" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere|anchorIgnoreIfNotPresent" "True" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere|anchorString" "\SDP" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere|optional" "False" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[1]|anchorIgnoreIfNotPresent" "True" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[1]|anchorString" "\OSDP" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[1]|optional" "True" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[2]|anchorIgnoreIfNotPresent" "True" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[2]|anchorString" "\OPSSDP" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[2]|optional" "True" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[2]|scaleValue" "0.7" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[3]|anchorIgnoreIfNotPresent" "True" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[3]|anchorString" "\PSSDP" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[3]|optional" "False" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[3]|scaleValue" "0.7" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere|anchorIgnoreIfNotPresent" "True" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere|anchorString" "\IDP" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere|optional" "False" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[1]|anchorIgnoreIfNotPresent" "True" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[1]|anchorString" "\OIDP" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[1]|optional" "True" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[2]|anchorIgnoreIfNotPresent" "True" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[2]|anchorString" "\OPSIDP" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[2]|optional" "True" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[2]|scaleValue" "0.5" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[3]|anchorIgnoreIfNotPresent" "True" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[3]|anchorString" "\PSIDP" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[3]|optional" "False" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[3]|scaleValue" "0.5" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner[1]|hostEmail" "admin@chilkatsoft.com" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner[1]|hostName" "Chilkat Admin" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner[1]|signerName" "Dealer Representative" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner[1]|recipientId" "2" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner[1]|routingOrder" "2" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere|anchorIgnoreIfNotPresent" "True" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere|anchorString" "\DSDP" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere|optional" "False" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere[1]|anchorIgnoreIfNotPresent" "True" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere[1]|anchorString" "\DOSDP" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere[1]|optional" "True" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere|anchorIgnoreIfNotPresent" "True" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere|anchorString" "\DIDP" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere|optional" "False" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere[1]|anchorIgnoreIfNotPresent" "True" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere[1]|anchorString" "\DOIDP" Send ComUpdateChildContent To hoXml "recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere[1]|optional" "True" Set ComEmitXmlDecl Of hoXml To False Get ComGetXml Of hoXml To sTemp1 Showln sTemp1 Set ComEmitCompact Of hoXml To True // IMPORTANT: This example requires Chilkat v9.5.0.75 or greater. Get ComGetXml Of hoXml To sTemp1 Get ComAddStringForUpload2 Of hoReq "" "" sTemp1 "utf-8" "application/xml" To iSuccess Get ComAddFileForUpload2 Of hoReq "" "qa_data/pdf/signatureForm.pdf" "application/pdf" To iSuccess Get ComAddSubHeader Of hoReq 1 "Content-Disposition" 'file; filename="signatureForm.pdf";documentid=1' To iSuccess Get Create (RefClass(cComChilkatHttp)) To hoHttp If (Not(IsComObjectCreated(hoHttp))) Begin Send CreateComObject of hoHttp End Set ComSessionLogFilename Of hoHttp To "qa_output/log.txt" Get pvComObject of hoReq to vReq Get ComSynchronousRequest Of hoHttp "na2.docusign.net" 443 True vReq To vResp If (IsComObject(vResp)) Begin Get Create (RefClass(cComChilkatHttpResponse)) To hoResp Set pvComObject Of hoResp To vResp End Get ComLastMethodSuccess Of hoHttp To bTemp1 If (bTemp1 <> True) Begin Get ComLastErrorText Of hoHttp To sTemp1 Showln sTemp1 Procedure_Return End Get ComStatusCode Of hoResp To iTemp1 If (iTemp1 <> 201) Begin Get ComBodyStr Of hoResp To sTemp1 Showln sTemp1 Get ComStatusCode Of hoResp To iTemp1 Showln "Response status code: " iTemp1 Showln "Failed." Send Destroy of hoResp Procedure_Return End // Examine the response.. Get ComBodyStr Of hoResp To sTemp1 Get ComLoadXml Of hoXml sTemp1 To iSuccess Get ComGetChildContent Of hoXml "envelopeId" To sEnvelopeId Showln "envelopeId = " sEnvelopeId Get ComGetChildContent Of hoXml "status" To sStatus Showln "status = " sStatus Get ComGetChildContent Of hoXml "statusDateTime" To sStatusDateTime Showln "statusDateTime = " sStatusDateTime Get ComGetChildContent Of hoXml "uri" To sUri Showln "uri = " sUri Send Destroy of hoResp End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.