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
(Android™) Send DocuSign XML RequestDemonstrates how to send a DocuSign XML request. Important:This example requires Chillkat v9.5.0.75 or greater.
// Important: Don't forget to include the call to System.loadLibrary // as shown at the bottom of this code sample. package com.test; import android.app.Activity; import com.chilkatsoft.*; import android.widget.TextView; import android.os.Bundle; public class SimpleActivity extends Activity { private static final String TAG = "Chilkat"; // Called when the activity is first created. @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // This requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. CkHttpRequest req = new CkHttpRequest(); req.put_HttpVerb("POST"); // Replace "12999999" with your own account number. (12999999 is a ficticious account number) req.put_Path("/restapi/v2/accounts/12999999/envelopes"); req.AddHeader("Accept","application/xml"); // Don't worry about the boundary string. Chilkat will automatically generate one and include it. req.put_ContentType("multipart/form-data"); CkXml xmlCred = new CkXml(); xmlCred.put_Tag("DocuSignCredentials"); xmlCred.UpdateChildContent("Username","YOUR_DOCUSIGN_USERNAME"); xmlCred.UpdateChildContent("Password","YOUR_DOCUSIGN_PASSWORD"); xmlCred.UpdateChildContent("IntegratorKey","ABCD-12345678-1234-AAAA-BBBB-abcdabcdabcd"); xmlCred.put_EmitXmlDecl(false); xmlCred.put_EmitCompact(true); req.AddHeader("X-DocuSign-Authentication",xmlCred.getXml()); // Don't worry about Host or Content-Length headers, Chilkat automatically adds them... // Build the XML for the 1st body part.. CkXml xml = new CkXml(); xml.put_Tag("envelopeDefinition"); xml.AddAttribute("xmlns","http://www.docusign.com/restapi"); xml.UpdateChildContent("emailSubject","Signature Request: Test Test:001019:033611"); xml.UpdateChildContent("status","sent"); xml.UpdateChildContent("documents|document|documentId","1"); xml.UpdateChildContent("documents|document|name","001019_TestTest_RetailDeals_163357"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|hostEmail","admin@chilkatsoft.com"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|hostName","Chilkat Admin"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|signerName","Test Test"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|recipientId","1"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|routingOrder","1"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|signerEmail","test@tyest.com"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere|anchorIgnoreIfNotPresent","True"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere|anchorString","\\SDP"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere|optional","False"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[1]|anchorIgnoreIfNotPresent","True"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[1]|anchorString","\\OSDP"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[1]|optional","True"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[2]|anchorIgnoreIfNotPresent","True"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[2]|anchorString","\\OPSSDP"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[2]|optional","True"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[2]|scaleValue","0.7"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[3]|anchorIgnoreIfNotPresent","True"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[3]|anchorString","\\PSSDP"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[3]|optional","False"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[3]|scaleValue","0.7"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere|anchorIgnoreIfNotPresent","True"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere|anchorString","\\IDP"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere|optional","False"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[1]|anchorIgnoreIfNotPresent","True"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[1]|anchorString","\\OIDP"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[1]|optional","True"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[2]|anchorIgnoreIfNotPresent","True"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[2]|anchorString","\\OPSIDP"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[2]|optional","True"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[2]|scaleValue","0.5"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[3]|anchorIgnoreIfNotPresent","True"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[3]|anchorString","\\PSIDP"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[3]|optional","False"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[3]|scaleValue","0.5"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|hostEmail","admin@chilkatsoft.com"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|hostName","Chilkat Admin"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|signerName","Dealer Representative"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|recipientId","2"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|routingOrder","2"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere|anchorIgnoreIfNotPresent","True"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere|anchorString","\\DSDP"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere|optional","False"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere[1]|anchorIgnoreIfNotPresent","True"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere[1]|anchorString","\\DOSDP"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere[1]|optional","True"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere|anchorIgnoreIfNotPresent","True"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere|anchorString","\\DIDP"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere|optional","False"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere[1]|anchorIgnoreIfNotPresent","True"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere[1]|anchorString","\\DOIDP"); xml.UpdateChildContent("recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere[1]|optional","True"); xml.put_EmitXmlDecl(false); Log.i(TAG, xml.getXml()); xml.put_EmitCompact(true); // IMPORTANT: This example requires Chilkat v9.5.0.75 or greater. req.AddStringForUpload2("","",xml.getXml(),"utf-8","application/xml"); req.AddFileForUpload2("","qa_data/pdf/signatureForm.pdf","application/pdf"); req.AddSubHeader(1,"Content-Disposition","file; filename=\"signatureForm.pdf\";documentid=1"); CkHttp http = new CkHttp(); http.put_SessionLogFilename("qa_output/log.txt"); CkHttpResponse resp = http.SynchronousRequest("na2.docusign.net",443,true,req); if (http.get_LastMethodSuccess() != true) { Log.i(TAG, http.lastErrorText()); return; } if (resp.get_StatusCode() != 201) { Log.i(TAG, resp.bodyStr()); Log.i(TAG, "Response status code: " + String.valueOf(resp.get_StatusCode())); Log.i(TAG, "Failed."); return; } // Examine the response.. xml.LoadXml(resp.bodyStr()); String envelopeId = xml.getChildContent("envelopeId"); Log.i(TAG, "envelopeId = " + envelopeId); String status = xml.getChildContent("status"); Log.i(TAG, "status = " + status); String statusDateTime = xml.getChildContent("statusDateTime"); Log.i(TAG, "statusDateTime = " + statusDateTime); String uri = xml.getChildContent("uri"); Log.i(TAG, "uri = " + uri); } static { System.loadLibrary("chilkat"); // Note: If the incorrect library name is passed to System.loadLibrary, // then you will see the following error message at application startup: //"The application <your-application-name> has stopped unexpectedly. Please try again." } } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.