Hello,
I have a created Flexicapture project which has 2 flexilayout templates. I have tested the FC project with a sample file using hot folders and it generates the output files. the project is configured to use a batch type (batchtypeId = 4).
I currently have a export file path configured on the General tab of the FC project properties. when i execute the code, the code is able to send the files to the server, the files are recognized and then I can see the output files being generated in the output folder.
The external file storage setting is disabled so the project information is stored in DB
I am trying to integrate the project with my application using the web services API. Below is the code snippet for this.
The statement Flexicapture.File attachedFile = client.LoadDocumentResult(document.Id, "MyResult.xml") returns a file with null bytes. there is however other file related information in the object such as the templatename, total symbols etc
If I remove the Export file path from the project properties, the bytes are still null
Can anyone provide guidance on this issue?
Code
--------------------------
var client = new FlexiCaptureWebServiceSoapClient();
client.ClientCredentials.UserName.UserName = "us\\abcd";
client.ClientCredentials.UserName.Password = "20w345uwrewrx333";
int roleType = 12;
int stationType = 10;
var sessionId = client.OpenSession(roleType, stationType);
var projectId = client.OpenProject(sessionId, "D232S-DF29-33A3-83GC-31E6DFD32359");
try
{
var userId = client.FindUser("us\\abcd");
var batch = new Batch();
batch.Name = "MGTestBatch";
batch.Description = "MGTestBatch";
batch.ErrorText = "";
batch.Id = 0;
batch.BatchTypeId = 4;
batch.Priority = 0;
var batchId = client.AddNewBatch(sessionId, projectId, batch, userId);
Flexicapture.File file1 = LoadFile("C:\\Test1\\Test file - revised (554390).pdf");
client.AddNewImage(sessionId, batchId, file1);
client.ProcessBatch(sessionId, batchId);
int percentCompleted = 0;
while (percentCompleted < 100)
{
percentCompleted = client.GetBatchPercentCompleted(batchId);
System.Threading.Thread.Sleep(500);
}
var documents = client.GetDocuments(batchId)
if (documents != null)
{
foreach(Flexicapture.Document document in documents)
{
Flexicapture.File attachedFile = client.LoadDocumentResult(document.Id, "MyResult.xml");
}
}
client.DeleteBatch(sessionId, batchId);
client.CloseProject(sessionId, projectId);
}catch(Exception ex)
{
var x = ex.Message;
}
finally
{
client.CloseSession(sessionId);
}
Comments
7 comments
Hello,
Please use the FlexiCaptureWebServiceApiVersion3 as described here: Application Programming Interface (API) > Examples of API Use instead of the FlexiCaptureWebServiceSoapClient.
In the code sample provided above, where batch.Priority = 0. What are other priority levels, and how are they represented numerically?
Hi Nirav,
Here is the list of priorities: http://help.abbyy.com/en-us/flexicapture/12/developer/tprocessingpriority_appendixscripts
Best regards,
Vladimir
Hello,
We have developed a program to upload a image file to FlexiCapture 11 and return recognition result via Web Service API.
I am currently working with FC12,the FlexiCaptureWebServiceApiVersion3 seems changed to FlexiCaptureWebServiceApi.
Hello,
Sorry, the samples for FlexiCapture 12 are still in progress and are not available for the moment. If you need future consultation please contact your regional support.
Hi CarlChan
We have had issues with with FlexiCapture Version 12 Web Services as well. we have been able to resolve some Issues while we have reached out to ABBYY Support for the rest. we have used the AFC 11 Web Service API sample (https://knowledgebase.abbyy.com/article/1271) “API Batch Browser” as the base of our testing.
We have been able to load a Multi page PDF file using the following steps
1. Create New Batch
2. Open Batch
3. Add Multipage PDF file
4. Process Batch
5. Close Batch
see below for sample code
if (File != null)
{
service.OpenBatch(sessionId, batchId);
FlexiCapture12API.Document doc = createNewDocument();
service.AddNewDocument(sessionId, doc, File, true, 0);
service.ProcessBatch(sessionId, batchId);
ProgressBarForm Progress = new ProgressBarForm();
Progress.bgw_Processing.DoWork += bgw_Processing_DoWork;
Progress.ShowDialog();
ShowDocuments();
service.CloseBatch(sessionId, batchId);
}
Listed below are the results of testing with some of the Functions in the sample.
Hope this helps
Thanks and Regards
Prasad
Hi Prasad,
Your reply is awesome!!
I finally able to upload image to the FC12 server!
The solution is just adding a single line of code, before creating a new batch
batch.StageExternalId = 900
It is very strange that I have to set the processing stage to be "Processed", before I import image and process the new batch.......
Anyway, I'm very happy that we can use Web API in FC12 now : )
Please sign in to leave a comment.