This web service performs barcode extraction on the input document PDF or a ZIP file (enclosed single page or multipage tiff/tif or pdf). Advanced Barcode Extraction plugin is fetched from the batch class corresponding to the input batch class identifier. The extraction is performed based on configurations of the extraction plugins and rules configured for the particular batch class.

Web Service URL:http://<HOSTNAME>:8080/dcma/rest/advBarcodeExtraction

Input Parameters

Input parameters to this Web Service API are:

  • PDF File: (single or multipage)/TIFF File (single or multipage)/ ZIP File (zip file may contain single page or multipage tif/tiff or pdf)
  • Batch Class Identifier: String parameter for batch class identifier

Document Type Name (optional parameter): if user enters a document type name, then no document classification is performed otherwise classification of the document is performed.

Output Parameters

Batch XML is the output for this web service.

CheckList:

  • Extraction is done only if Extraction module is configured for the particular batch class.
  • Extraction is performed only if the advanced barcode extraction plugin is present in particular batch class, with its switch ON.

Sample for XML

private static void advancedBarcodeExtraction() {

                                HttpClient client = new HttpClient();

                                String url = “http://localhost:8080/dcma/rest/advancedBarcodeExtraction“;

                                PostMethod mPost = new PostMethod(url);

                                File file1 = new File(“C:\\sample\\sample.xml”);

                                // adding xml file for taking input

                                File file2 = new File(“C:\\sample\\US-Invoice.tif”);

                                Part[] parts = new Part[2];

                                try {

                                                parts[0] = new FilePart(file1.getName(), file1);

                                                parts[1] = new FilePart(file2.getName(), file2);

                                                MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());

                                                mPost.setRequestEntity(entity);

                                                int statusCode = client.executeMethod(mPost);

                                                if (statusCode == 200) {

                                                                System.out.println(“Web service executed successfully.”);

                                                                System.out.println(mPost.getResponseBodyAsString());

                                                } else if (statusCode == 403) {

                                                                System.out.println(“Invalid username/password.”);

                                                } else {

                                                                System.out.println(mPost.getResponseBodyAsString());

                                                }

                                } catch (HttpException e) {

                                                e.printStackTrace();

                                } catch (IOException e) {

                                                e.printStackTrace();

                                } finally {

                                                if (mPost != null) {

                                                                mPost.releaseConnection();

                                                }

                                }

                }

Was this article helpful to you?

Engineering