0

DocuSign を使用して電子署名をリクエストに追加していますが、すべて正常に機能しています。現在、埋め込みメソッドを使用して署名リクエストを送信し、URL に移動してワークフローをすぐに開始しています。

ログイン後、次のコードを実行すると、(埋め込みビュー: https://demo.docusign.net/Member/StartInSession.aspx?StartConsole=1&t=32598057-5a59-4d0b-bad8-a8ff8f2407f6&DocuEnvelope=168bc155-e013- 4ffd-abb4-7608b56647f8&send=1 )、しかし、URL を貼り付けてナビゲートでドキュメントに署名しようとすると、別の URL にリダイレクトされます ( http://www.docusign.com/?event=Send&envelopeId=168bc155-e013 -4ffd-abb4-7608b56647f8 )、

エンベロープに署名するために wotkflow プロセスを開始するにはどうすればよいですか?? サインする封筒が見えません。

// ステップ 2 - 1 つの受信者、ドキュメント、およびタブを含む封筒を作成して送信 //

    String jsonBody = "{\"emailBlurb\":\"partail\"," + 
            "\"emailSubject\":\"API Call for adding signature request to document and sending\"," + 
            "\"documents\":[{" + 
            "\"documentId\":\"1\"," + 
            "\"name\":\"test.pdf\"}]," + 
            "\"recipients\":{" + 
            "\"signers\":[{" + 
            "\"email\":\"" + EmailRecipients + "\"," + 
            "\"name\":\"name\"," + 
            "\"recipientId\":\"1\"," +
            "\"routingOrder\":\"1\","+
            "\"clientUserId\":\"1000\","+              
            "\"tabs\":{" + 
            "\"signHereTabs\":[{" + 
            "\"xPosition\":\"300\"," + 
            "\"yPosition\":\"600\"," + 
            "\"documentId\":\"1\"," + 
            "\"pageNumber\":\"1\"" + "}]}}]}," + 
            "\"status\":\"sent\"}";
          //DemandeSign.getenvelope();


    File file = new File("D:/test.pdf");
    InputStream inputStream = new FileInputStream(file); 
    byte[] bytes = new byte[(int) file.length()];
    inputStream.read(bytes);
    inputStream.close();

    String requestBody = "\r\n\r\n--BOUNDARY\r\n" + 
            "Content-Type: application/json\r\n" + 
            "Content-Disposition: form-data\r\n" + 
            "\r\n" + 
            jsonBody + "\r\n\r\n--BOUNDARY\r\n" +   // our json formatted request body
            "Content-Type: application/pdf\r\n" + 
            "Content-Disposition: file; filename=\"test.pdf\"; documentId=1\r\n" + 
            "\r\n";
        // we break this up into two string since the PDF doc bytes go here and are not in string format.
        // see further below where we write to the outputstream...
    String reqBody2 = "\r\n" + "--BOUNDARY--\r\n\r\n";

    // append "/envelopes" to the baseUrl and use in the request
    conn = (HttpURLConnection)new URL(baseURL + "/envelopes").openConnection();
    conn.setRequestMethod("POST");
    conn.setDoOutput(true);
    conn.setRequestProperty("X-DocuSign-Authentication", authenticateStr);
    conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=BOUNDARY");
    conn.setRequestProperty("Content-Length", Integer.toString(requestBody.toString().length()));
    conn.setRequestProperty("Accept", "application/xml"); 

    // write the body of the request...
    DataOutputStream dos = new DataOutputStream( conn.getOutputStream() );
    dos.writeBytes(requestBody.toString()); 
    dos.write(bytes);
    dos.writeBytes(reqBody2.toString()); 
    dos.flush(); dos.close();
    status = conn.getResponseCode(); // triggers the request
    if( status != 201 ) // 201 = Created
    {
        System.out.println("Error calling webservice, status is: " + status);
        InputStreamReader isr = new InputStreamReader( conn.getErrorStream() );
        br = new BufferedReader(isr);
        StringBuilder error_response = new StringBuilder();
        while ( (line = br.readLine()) != null)
            error_response.append(line);
        System.out.println("Error response is " + error_response.toString() );
        System.exit(-1);
    }
    // Read the response
    InputStreamReader isr = new InputStreamReader( conn.getInputStream() );
    br = new BufferedReader(isr);
    StringBuilder response2 = new StringBuilder();
    while ( (line = br.readLine()) != null)
        response2.append(line);
    //token1 = "//*[1]/*[local-name()='envelopeId']";
    //String envelopeId = xPath.evaluate(token1, new InputSource(new StringReader(response2.toString())));

    //--- display results
    //System.out.println("Document sent!  envelopeId is " + envelopeId );//envelopeId is e4c0659a-9d01-4ac3-a45f-02a80fd6bd96 at 04/07/2013 17:24


    token1 = "//*[1]/*[local-name()='uri']";
    String uri = xPath.evaluate(token1, new InputSource(new StringReader(response2.toString())));
    //--- display results
    System.out.println("uri = " + uri );


/// Step3
// construct another outgoing XML request body
String reqBody = "<returnUrlRequest xmlns=\"http://www.docusign.com/restapi\">" +
"<authenticationMethod>email</authenticationMethod>" +
"<email>***test@gmail.com***</email>" +
"<returnUrl>http://www.docusign.com</returnUrl>" +
"<userName>name</userName>" +
"<clientUserId>1000</clientUserId>" +
"</returnUrlRequest>";

// append uri + "/views/sender" to the baseUrl and use in the request
conn = (HttpURLConnection)new URL(baseURL + uri + "/views/sender").openConnection();
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.setRequestProperty("X-DocuSign-Authentication", authenticateStr);
conn.setRequestProperty("Content-Type", "application/xml");
conn.setRequestProperty("Content-Length", Integer.toString(reqBody.length()));
conn.setRequestProperty("Accept", "application/xml");
// write the body of the request...
dos = new DataOutputStream( conn.getOutputStream() );
dos.writeBytes(reqBody); dos.flush(); dos.close();
status = conn.getResponseCode(); // triggers the request
if( status != 201 ) // 201 = Created
{
System.out.println("Error calling webservice, status is: " + status);
System.exit(-1);
}
// Read the response
isr = new InputStreamReader( conn.getInputStream() );
br = new BufferedReader(isr);
StringBuilder response3 = new StringBuilder();
while ( (line = br.readLine()) != null)
response3.append(line);
token1 = "//*[1]/*[local-name()='url']";
//--- display results
System.out.println("Embedded View: " + xPath.evaluate(token1, new InputSource(new StringReader(response3.toString()))));`
4

1 に答える 1

0

すぐに URL にアクセスしようとしていますか、それともまったく待機していますか? 特定のエンベロープにアクセスするための URL トークンを生成すると、その TTL (time to life) は 5 分になります。つまり、5 分後に有効期限が切れるため、新しいトークンを生成する必要があります。

そうでない場合、問題は受信者の識別方法に関連している可能性があります。DocuSign の受信者は、名前、電子メール、recipientId、および埋め込みの場合は clientUserId の一意の組み合わせによって識別されます。これらすべてを設定しているようですが、最初にエンベロープを作成するときの組み合わせが何であれ、埋め込み URL トークンを要求するときに同じ組み合わせを参照する必要があります。

エンベロープを作成すると、名前を文字通り「name」に設定し、「EmailRecipients」という変数を介して電子メールを設定していることがわかります。ただし、メール「test@gmail.com」を使用している URL トークンを要求すると、それも問題の原因となっている可能性があります。

于 2013-07-10T18:06:30.603 に答える