java - screen signing document not appear, and event=ttl_expired -
hi, i've tried sign document using docusign's embedded signing feature, when send request, screen signing document doesn't appear, , redirects me page url parameter of event=ttl_expired.
i know ttl (time-to-life) = 5 minutes url tokens, can please me?
url tokens valid 5 minutes. if being re-directed screen has url parameter of event=ttl_expired means trying access signing workflow expired url token.
when url tokens expire need generate new one. have seen docusign's api walkthroughs? there's 9 common use-cases of docusign's rest api , 1 of them embedded signing. each walkthrough has code showing how accomplish task in 6 different languages (php, javascript, java, c#, objective-c, python).
see here walkhthroughs: http://iodocs.docusign.com/apiwalkthroughs
for instance, since php easy run command line here working php program generate valid url token signing, taken embedded signing api walkthrough. enter credentials , valid template id account , work you:
<?php // input info: $integratorkey = '...'; $email = '...@....com'; $password = '...'; $name = "john doe"; // copy templateid of existing template here $templateid = "c9d9d181-ce57-....................."; // construct authentication header: $header = "<docusigncredentials><username>" . $email . "</username><password>" . $password . "</password><integratorkey>" . $integratorkey . "</integratorkey></docusigncredentials>"; ///////////////////////////////////////////////////////////////////////////////////////////////// // step 1 - login (retrieves baseurl , accountid) ///////////////////////////////////////////////////////////////////////////////////////////////// $url = "https://demo.docusign.net/restapi/v2/login_information"; $curl = curl_init($url); curl_setopt($curl, curlopt_header, false); curl_setopt($curl, curlopt_returntransfer, true); curl_setopt($curl, curlopt_httpheader, array("x-docusign-authentication: $header")); $json_response = curl_exec($curl); $status = curl_getinfo($curl, curlinfo_http_code); if ( $status != 200 ) { echo "error calling webservice, status is:" . $status; exit(-1); } $response = json_decode($json_response, true); $accountid = $response["loginaccounts"][0]["accountid"]; $baseurl = $response["loginaccounts"][0]["baseurl"]; curl_close($curl); //--- display results echo "accountid = " . $accountid . "\nbaseurl = " . $baseurl . "\n"; ///////////////////////////////////////////////////////////////////////////////////////////////// // step 2 - create envelope embedded recipient (uses clientuserid property) ///////////////////////////////////////////////////////////////////////////////////////////////// $data = array("accountid" => $accountid, "emailsubject" => "hello world!", "emailblurb" => "this comes php", "templateid" => $templateid, "templateroles" => array( array( "email" => $email, "name" => $name, "rolename" => "signer1", "clientuserid" => "1001" )), "status" => "sent"); $data_string = json_encode($data); $curl = curl_init($baseurl . "/envelopes" ); curl_setopt($curl, curlopt_returntransfer, true); curl_setopt($curl, curlopt_post, true); curl_setopt($curl, curlopt_postfields, $data_string); curl_setopt($curl, curlopt_httpheader, array( 'content-type: application/json', 'content-length: ' . strlen($data_string), "x-docusign-authentication: $header" ) ); $json_response = curl_exec($curl); $status = curl_getinfo($curl, curlinfo_http_code); if ( $status != 201 ) { echo "error calling webservice, status is:" . $status . "\nerror text --> "; print_r($json_response); echo "\n"; exit(-1); } $response = json_decode($json_response, true); $envelopeid = $response["envelopeid"]; curl_close($curl); //--- display results echo "envelope created! envelope id: " . $envelopeid . "\n"; ///////////////////////////////////////////////////////////////////////////////////////////////// // step 3 - embedded singing view ///////////////////////////////////////////////////////////////////////////////////////////////// $data = array("returnurl" => "http://www.docusign.com/devcenter", "authenticationmethod" => "none", "email" => $email, "username" => $name, clientuserid => "1001" ); $data_string = json_encode($data); $curl = curl_init($baseurl . "/envelopes/$envelopeid/views/recipient" ); curl_setopt($curl, curlopt_returntransfer, true); curl_setopt($curl, curlopt_post, true); curl_setopt($curl, curlopt_postfields, $data_string); curl_setopt($curl, curlopt_httpheader, array( 'content-type: application/json', 'content-length: ' . strlen($data_string), "x-docusign-authentication: $header" ) ); $json_response = curl_exec($curl); $status = curl_getinfo($curl, curlinfo_http_code); if ( $status != 201 ) { echo "error calling webservice, status is:" . $status . "\nerror text --> "; print_r($json_response); echo "\n"; exit(-1); } $response = json_decode($json_response, true); $url = $response["url"]; //--- display results echo "embedded url is: \n\n" . $url . "\n\nnavigate url start embedded signing view of envelope\n"; ?>
Comments
Post a Comment