Community

How do I retrieve a generated document using Service API

I wrote a simple C# program and added the Web reference for flexicapture webservice api version 2. I was able to add a new batch, upload images and process the batch to generate the documents.
The generated documents where exported according to the project configuration and the document definition in application server, but I couldn't retrieve them using the API.

My question is, can I retrieve those documents using the webservice API?
If that is possible, Is it a setting or feature I must enable in project configuration or somewhere else?

Thanks in advance,

Best regards.

L.

0

Comments

4 comments

  • Avatar
    Sushi
    luchsrock,

    The answer to your question is yes you can retrieve data through the web service API. Most likely your issue is your export. If you export the data outside of the system, then you can't use the Web Service API to retrieve them. Basically check the following:

    1) In you DocDef under the export setting. Make sure the location does not show a relative path. i.e. don't have c:\temp\export. Instead just use "Export"
    2) Under your project properties, in the Root Path section. Make sure this is blank and doesn't have a relative path either.

    Now when the data gets exported out, it will save the exported data in the FlexiCapture Database. You can do a "service.GetDocumentResultsList(documentId)" to get your results
    0
  • Avatar
    luchosrock
    Thanks for the reply Sushi!

    Like you said, my issue is the _export_ phase. I applied the settings you said but I couldn't retrieve the generated document through the API.

    The service.GetDocumentResultsList(documentId) statement returned a string array with the value "Export\\documentname.xml", but I couldn't manage to download that document from the Application Server to my computer.
    How (If possible) can I acomplish this?

    Regards,
    L.

    0
  • Avatar
    Sushi
    luchosrock,

    Here is a code snippet. Basically I save it onto my my computer on a sharefolder.

    string [] results = service.GetDocumentResultsList(documentId);
    int x = 0;
    foreach(string value in results)
    {
    if (value.Contains("xml"))
    {
    break;
    }
    x++;
    }
    FlexiCapture.File file = service.LoadDocumentResult( documentId, results[x]);
    XmlDocument doc = new XmlDocument();
    MemoryStream ms = new MemoryStream( file.Bytes );
    doc.Load( ms );
    doc.Save("\\\\computername\\ShareFolder\\Output\\export.xml");
    0
  • Avatar
    luchosrock
    It works pretty well!

    I was missing the structure's hierarchy when retrieving the DocumentResult, I needed the DocumentResultsList in order to make the call to LoadDocumentResult. The snippet you posted clarifies that.

    Thanks a lot.


    0

Please sign in to leave a comment.