The DownloadTemplate operation can be used to download the underlying PDF for a document template. This operation should not be used with workflow-only templates.
The DownloadTemplate operation requires knowledge of the following:
- the AssureSign account ContextIdentifier (this is exposed in the AssureSign administrative application account settings and serves to provide some security to the transaction)
- The TemplateId that uniquely identifies the document template for which the underlying PDF is being downloaded.
- The AssureSign UserName of the user requesting the template PDF download.
Sample XML
<?xml version="1.0" encoding="utf-8"?>
<DownloadTemplate xmlns="https://www.assuresign.net/Services/DocumentNOW/DownloadTemplate">
<DownloadTemplateRequest ContextIdentifier="06C4A84A-693C-46CB-8DF2-40A8215AA056" TemplateId="2CE11EF1-8938-DD11-8735-00065B8CE99B" UserName="jdoe@example.com" />
</DownloadTemplate>
The SOAP Action header is
https://www.assuresign.net/Services/DocumentNOW/DownloadTemplate/IDownloadTemplateService/DownloadTemplate
A response will return the TemplateId along with the actual file data for the template PDF.
The DownloadTemplate operation exposes two endpoints allowing it to be executed using either the W3C standard Message Transmission Optimization Mechanism (MTOM) protocol or not. If the MTOM endpoint is used, the returned template PDF will be passed in its original raw binary form using XML-binary Optimized Packaging (XOP). If the non-MTOM endpoint is used, this PDF will be Base64-encoded and included directly in the response XML itself.
Sample XML (non-MTOM) returned by the DownloadTemplate operation is presented here:
<?xml version="1.0" encoding="utf-8"?>
<DownloadTemplateResponse xmlns="https://www.assuresign.net/Services/DocumentNOW/DownloadTemplate">
<DownloadTemplateResult TemplateId="2CE11EF1-8938-DD11-8735-00065B8CE99B">
<FileData>RGFOYQ==</FileData>
</DownloadTemplateResult>
</DownloadTemplateResponse>
The DownloadTemplateResult should be checked for the presence of an Exceptions element, which may contain multiple DownloadTemplateException items.