Signing

Check the status and result of a document order

423 views August 3, 2017 October 9, 2017 2

The method getStatus can be used to inspect the status of a document order and to get the result. There are several mechanisms available to be notified when a document order has changed, so you must never poll the getStatus method to monitor a document order. Please see the other code examples of how to notified of changes without polling.

[TestMethod]
public void How_to_check_the_status_and_result_of_a_document_order()
{
    string requestId = "300820136vkdfvmxmh3f0ajx4ayaqfb25tsyfut2jptr3zz063dnm5kag";
    using (var client = new DocumentEndPointClient())
    {
        var request = new getstatusrequest
        {
            password = "Bond007",
            service = "demo",
            requestid = new string[]
            {
                requestId
            }
        };

        var taskStatusInfo = client.getStatus(request);
        Assert.AreEqual(1, taskStatusInfo.Length);
        Assert.AreEqual(taskstatus.completed, taskStatusInfo[0].taskstatus);
        Assert.AreEqual("doc_1", taskStatusInfo[0].documentstatus[0].id);


        string taskId = "task_1";
        string documentId = "doc_1";
        string originalUri = string.Format("https://preprod.signicat.com/doc/demo/order/{0}/{1}/{2}/original", requestId, taskId, documentId);
        string resultUri = string.Format("https://preprod.signicat.com/doc/demo/order/{0}/{1}/{2}/sdo", requestId, taskId, documentId);


        Assert.AreEqual(originalUri, taskStatusInfo[0].documentstatus[0].originaluri);
        Assert.AreEqual(resultUri, taskStatusInfo[0].documentstatus[0].resulturi);
        Console.WriteLine("original=" + originalUri);
        Console.WriteLine("result=" + resultUri);
    }
}
package com.signicat.signature;

import com.signicat.document.v2.*;
import org.junit.Assert;
import org.junit.Test;
import javax.xml.ws.Service;

public class CheckStatus {

    @Test
    public void how_to_check_the_status_and_result_of_a_document_order() {
        String requestId = "300820136vkdfvmxmh3f0ajx4ayaqfb25tsyfut2jptr3zz063dnm5kag";
        Service documentService = new DocumentService();
        DocumentEndPoint client = documentService.getPort(DocumentEndPoint.class);

        GetStatusRequest request = new GetStatusRequest();
        request.setPassword("Bond007");
        request.setService("demo");
        request.getRequestId().add(requestId);

        GetStatusResponse taskStatusInfo = client.getStatus(request);
        Assert.assertEquals(1, taskStatusInfo.getTaskStatusInfo().size());
        Assert.assertEquals(TaskStatus.COMPLETED, taskStatusInfo.getTaskStatusInfo().get(0).getTaskStatus());
        Assert.assertEquals("doc_1", taskStatusInfo.getTaskStatusInfo().get(0).getDocumentStatus().get(0).getId());

        String taskId = "task_1";
        String documentId = "doc_1";
        String originalUri = String.format("https://preprod.signicat.com/doc/demo/order/%s/%s/%s/original", requestId, taskId, documentId);
        String resultUri = String.format("https://preprod.signicat.com/doc/demo/order/%s/%s/%s/sdo", requestId, taskId, documentId);

        Assert.assertEquals(originalUri, taskStatusInfo.getTaskStatusInfo().get(0).getDocumentStatus().get(0).getOriginalUri());
        Assert.assertEquals(resultUri, taskStatusInfo.getTaskStatusInfo().get(0).getDocumentStatus().get(0).getResultUri());
        System.out.println("original=" + originalUri);
        System.out.println("result=" + resultUri);
    }
}

 

Was this helpful?