Community

ABBYY FC11 get XML with coordinates

I try to use example from help(Working with Files > POST Request on FileService handler) to read XML file which contains all text with coordinates, but I have no luck. I got empty response without error status code is 200 but content length is 0. Is there a concrete example of how to get XML with coordinates over POST request? Is it possible to get XML over SOAP request?


0

Comments

8 comments

  • Avatar
    Anastasiya Nechaeva
    Hi Mirko,

    In order to help you with this issue we need to have a look your project.
    Could you please share it with us?
    0
  • Avatar
    mirko.fisic
    Here is sample project(dll) which I call on verification process, I try to get XML with all recognized words and coordinates over soap and over http post request.

    Thank you in advance.
    0
  • Avatar
    Anastasiya Nechaeva
    Mirko,

    We reproduced this issue. We got DocumentBody, but could not get RecognizedWord with the same sample.
    It would be better to contact with a regional support team for resolving the issue.
    0
  • Avatar
    mirko.fisic
    Please can you show me with which parameters you got DocumentBody.
    Thank you.
    0
  • Avatar
    Anastasiya Nechaeva
    We got the task from verification stage using the following parameters:

    // Open session

    int sessionId = client.OpenSession(3, 3);
    try
    {

    //POST REQUEST
    // Open our project

    int projectId = client.OpenProject(sessionId, "Invoices_eng");
    int VerifStage = 500;
    int taskId = client.GetTask(sessionId, projectId, VerifStage, false, false);
    FlexiCapture.Task task = client.GetTaskInfo(taskId);
    int batchId = task.BatchId;

    //bool batchSucceeded = client.OpenBatch(sessionId, batchId);

    string outputFile = "C:\\Temp\\result.xml";
    TaskDocumentList documentList = client.GetTaskDocuments(taskId);

    //get DocumentBody for the first document in the list

    List bytes = POSTLoadFile(serverUrl, sessionId, projectId, batchId, 0, documentList[0].Id, 0, "DocumentBody");



    0
  • Avatar
    mirko.fisic
    I have problem to get DocumentBody too. I create project in Java, I used WSDL version 3. I will send you part of the code.

    First problem occurs when I try to get task id over function getTask() and I get 0 value. So I decide to use function getAvailableTasks() and I got Task with stageType 500 and first I try to get document body over soap:

     sessionId = service.openSession(3, 3);

    projectId = service.openProject(sessionId, "MyprojectName");



    int taskId = service.getTask(sessionId, projectId, VerifStage, false, false);// 0 value


    TaskList taskList = service.getAvailableTasks(sessionId, projectId, VerifStage, false); //I got task with stageType 500


    List listTask = taskList.getTask();





    for(Task task : listTask) {





    if(task.getStageType() != 500) continue;


    int batchID = task.getBatchId();


    if(batchID > 0) {


    boolean tbopen = service.openBatch(sessionId, batchID);





    TaskDocumentList documentList = service.getTaskDocuments(task.getId());


    List listd = documentList.getDocument();





    for(Document doc : listd) {





    GetDocumentResultsListResponse.FileNames fname = service.getDocumentResultsList(doc.getId());


    if(fname != null) {


    List flist = fname.getString();


    for(String fn : flist) {





    File result = service.loadDocumentResult(doc.getId(), fn);


    rs += new String(result.getBytes(), Charset.forName("UTF-8"));


    }


    }


    }


    }


    }


    in this examaple I try to call HTTPRequest POST but I got only empty response:

     sessionId = service.openSession(3, 3);

    projectId = service.openProject(sessionId, "MyprojectName");



    int taskId = service.getTask(sessionId, projectId, VerifStage, false, false);// 0 value


    TaskList taskList = service.getAvailableTasks(sessionId, projectId, VerifStage, false); //I got task with stageType 500


    List listTask = taskList.getTask();





    for(Task task : listTask) {





    if(task.getStageType() != 500) continue;


    int batchID = task.getBatchId();


    if(batchID > 0) {


    boolean tbopen = service.openBatch(sessionId, batchID);





    TaskDocumentList documentList = service.getTaskDocuments(task.getId());


    List listd = documentList.getDocument();





    for(Document doc : listd) {



    Properties systemSettings = System.getProperties();


    systemSettings.put("http.proxyHost", "localhost");


    systemSettings.put("http.proxyPort", "80");





    Authenticator.setDefault(new Authenticator() {


    @Override


    protected PasswordAuthentication getPasswordAuthentication() {


    return new PasswordAuthentication("User", "Pass".toCharArray());


    }


    });





    String targetURL = "http://localhost/FlexiCapture11/Server/WebServices.dll?Handler=FileService";


    String urlParameters = URLEncoder.encode("Action", "UTF-8") + "=" + URLEncoder.encode("Load", "UTF-8");


    urlParameters += "&" + URLEncoder.encode("sessionId", "UTF-8") + "=" + URLEncoder.encode(Integer.toString(sessionId), "UTF-8");


    urlParameters += "&" + URLEncoder.encode("objectType", "UTF-8") + "=" + URLEncoder.encode(Integer.toString(0), "UTF-8");


    urlParameters += "&" + URLEncoder.encode("projectId", "UTF-8") + "=" + URLEncoder.encode(Integer.toString(projectId), "UTF-8");


    urlParameters += "&" + URLEncoder.encode("batchId", "UTF-8") + "=" + URLEncoder.encode(Integer.toString(batchID), "UTF-8");


    urlParameters += "&" + URLEncoder.encode("objectId", "UTF-8") + "=" + URLEncoder.encode(Integer.toString(doc.getId()), "UTF-8");


    urlParameters += "&" + URLEncoder.encode("version", "UTF-8") + "=" + URLEncoder.encode(Integer.toString(doc.getFileVersion()), "UTF-8");


    urlParameters += "&" + URLEncoder.encode("streamName", "UTF-8") + "=" + URLEncoder.encode("DocumentBody", "UTF-8");





    URL url = new URL(targetURL);


    connection = (HttpURLConnection) url.openConnection();


    connection.setRequestMethod("POST");


    connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");


    connection.setUseCaches(false);


    connection.setDoOutput(true);


    connection.setDoInput(true);





    InputStream eis = connection.getErrorStream();


    StringBuilder eresponse = new StringBuilder();


    eresponse.append("ERRoR::");


    if (eis != null) {


    BufferedReader erd = new BufferedReader(new InputStreamReader(eis));


    //StringBuilder eresponse = new StringBuilder();


    String eline = "";


    while ((eline = erd.readLine()) != null) {


    eresponse.append(eline);


    eresponse.append('\r');


    }


    erd.close();


    }





    //Send request


    DataOutputStream wr = new DataOutputStream(connection.getOutputStream());


    wr.writeBytes(urlParameters);


    wr.close();





    int responsecode = connection.getResponseCode();





    //Get Response


    InputStream is = connection.getInputStream();


    BufferedReader rd = new BufferedReader(new InputStreamReader(is));


    StringBuilder response = new StringBuilder();


    String line;


    while ((line = rd.readLine()) != null) {


    response.append(line);


    response.append('\r');


    }


    rd.close();


    connection.close()


    writer.write(responsecode + " " + response.toString() + " " + eresponse.toString());





    }


    }


    }




    0
  • Avatar
    mirko.fisic
    Here is complete C# project if you can check one more time, I try to get DocumentBody over soap and over HTTP Post request but no success.

    Thank you in andvance
    0
  • Avatar
    mirko.fisic
    I made a mistake, I used a load image function instead import image in verification station and because of that ABBYY has not generated DocumentBody file and RecognizedWords file.
    0

Please sign in to leave a comment.