Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

PowerBuilder Examples

Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text
HTTP

HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
MS Storage Providers
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(PowerBuilder) Send DocuSign XML Request

Demonstrates how to send a DocuSign XML request.

Important:This example requires Chillkat v9.5.0.75 or greater.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

integer li_rc
oleobject loo_Req
oleobject loo_XmlCred
oleobject loo_Xml
oleobject loo_Http
oleobject loo_Resp
string ls_EnvelopeId
string ls_Status
string ls_StatusDateTime
string ls_Uri

// This requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loo_Req = create oleobject
// Use "Chilkat_9_5_0.HttpRequest" for versions of Chilkat < 10.0.0
li_rc = loo_Req.ConnectToNewObject("Chilkat.HttpRequest")
if li_rc < 0 then
    destroy loo_Req
    MessageBox("Error","Connecting to COM object failed")
    return
end if

loo_Req.HttpVerb = "POST"

// Replace "12999999" with your own account number. (12999999 is a ficticious account number)
loo_Req.Path = "/restapi/v2/accounts/12999999/envelopes"

loo_Req.AddHeader("Accept","application/xml")

// Don't worry about the boundary string.  Chilkat will automatically generate one and include it.
loo_Req.ContentType = "multipart/form-data"

loo_XmlCred = create oleobject
// Use "Chilkat_9_5_0.Xml" for versions of Chilkat < 10.0.0
li_rc = loo_XmlCred.ConnectToNewObject("Chilkat.Xml")

loo_XmlCred.Tag = "DocuSignCredentials"
loo_XmlCred.UpdateChildContent("Username","YOUR_DOCUSIGN_USERNAME")
loo_XmlCred.UpdateChildContent("Password","YOUR_DOCUSIGN_PASSWORD")
loo_XmlCred.UpdateChildContent("IntegratorKey","ABCD-12345678-1234-AAAA-BBBB-abcdabcdabcd")
loo_XmlCred.EmitXmlDecl = 0
loo_XmlCred.EmitCompact = 1
loo_Req.AddHeader("X-DocuSign-Authentication",loo_XmlCred.GetXml())

// Don't worry about Host or Content-Length headers, Chilkat automatically adds them...

// Build the XML for the 1st body part..
loo_Xml = create oleobject
// Use "Chilkat_9_5_0.Xml" for versions of Chilkat < 10.0.0
li_rc = loo_Xml.ConnectToNewObject("Chilkat.Xml")

loo_Xml.Tag = "envelopeDefinition"
loo_Xml.AddAttribute("xmlns","http://www.docusign.com/restapi")
loo_Xml.UpdateChildContent("emailSubject","Signature Request: Test Test:001019:033611")
loo_Xml.UpdateChildContent("status","sent")
loo_Xml.UpdateChildContent("documents|document|documentId","1")
loo_Xml.UpdateChildContent("documents|document|name","001019_TestTest_RetailDeals_163357")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|hostEmail","admin@chilkatsoft.com")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|hostName","Chilkat Admin")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|signerName","Test  Test")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|recipientId","1")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|routingOrder","1")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|signerEmail","test@tyest.com")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere|anchorIgnoreIfNotPresent","True")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere|anchorString","\SDP")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere|optional","False")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[1]|anchorIgnoreIfNotPresent","True")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[1]|anchorString","\OSDP")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[1]|optional","True")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[2]|anchorIgnoreIfNotPresent","True")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[2]|anchorString","\OPSSDP")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[2]|optional","True")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[2]|scaleValue","0.7")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[3]|anchorIgnoreIfNotPresent","True")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[3]|anchorString","\PSSDP")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[3]|optional","False")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[3]|scaleValue","0.7")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere|anchorIgnoreIfNotPresent","True")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere|anchorString","\IDP")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere|optional","False")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[1]|anchorIgnoreIfNotPresent","True")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[1]|anchorString","\OIDP")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[1]|optional","True")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[2]|anchorIgnoreIfNotPresent","True")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[2]|anchorString","\OPSIDP")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[2]|optional","True")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[2]|scaleValue","0.5")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[3]|anchorIgnoreIfNotPresent","True")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[3]|anchorString","\PSIDP")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[3]|optional","False")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[3]|scaleValue","0.5")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|hostEmail","admin@chilkatsoft.com")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|hostName","Chilkat Admin")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|signerName","Dealer Representative")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|recipientId","2")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|routingOrder","2")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere|anchorIgnoreIfNotPresent","True")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere|anchorString","\DSDP")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere|optional","False")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere[1]|anchorIgnoreIfNotPresent","True")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere[1]|anchorString","\DOSDP")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere[1]|optional","True")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere|anchorIgnoreIfNotPresent","True")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere|anchorString","\DIDP")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere|optional","False")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere[1]|anchorIgnoreIfNotPresent","True")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere[1]|anchorString","\DOIDP")
loo_Xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere[1]|optional","True")
loo_Xml.EmitXmlDecl = 0

Write-Debug loo_Xml.GetXml()

loo_Xml.EmitCompact = 1

// IMPORTANT: This example requires Chilkat v9.5.0.75 or greater.
loo_Req.AddStringForUpload2("","",loo_Xml.GetXml(),"utf-8","application/xml")
loo_Req.AddFileForUpload2("","qa_data/pdf/signatureForm.pdf","application/pdf")
loo_Req.AddSubHeader(1,"Content-Disposition","file; filename=~"signatureForm.pdf~";documentid=1")

loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")

loo_Http.SessionLogFilename = "qa_output/log.txt"

loo_Resp = loo_Http.SynchronousRequest("na2.docusign.net",443,1,loo_Req)
if loo_Http.LastMethodSuccess <> 1 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Req
    destroy loo_XmlCred
    destroy loo_Xml
    destroy loo_Http
    return
end if

if loo_Resp.StatusCode <> 201 then
    Write-Debug loo_Resp.BodyStr
    Write-Debug "Response status code: " + string(loo_Resp.StatusCode)
    Write-Debug "Failed."
    destroy loo_Resp
    destroy loo_Req
    destroy loo_XmlCred
    destroy loo_Xml
    destroy loo_Http
    return
end if

// Examine the response..
loo_Xml.LoadXml(loo_Resp.BodyStr)
ls_EnvelopeId = loo_Xml.GetChildContent("envelopeId")
Write-Debug "envelopeId = " + ls_EnvelopeId
ls_Status = loo_Xml.GetChildContent("status")
Write-Debug "status = " + ls_Status
ls_StatusDateTime = loo_Xml.GetChildContent("statusDateTime")
Write-Debug "statusDateTime = " + ls_StatusDateTime
ls_Uri = loo_Xml.GetChildContent("uri")
Write-Debug "uri = " + ls_Uri

destroy loo_Resp


destroy loo_Req
destroy loo_XmlCred
destroy loo_Xml
destroy loo_Http

 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.