Quantcast
Channel: Ephesoft Docs
Viewing all articles
Browse latest Browse all 478

extractFuzzyDB

$
0
0

This API will create the document level fields for the document type using fuzzy Db based extraction for the specified batch class for HOCR file.

Request Method POST

Input Parameters

Input Parameter Values Descriptions
documentType This should not be empty and valid document type for that batch class This parameter is used for generating document level fields for defined document type.
batchClassIdentifier This should not be empty and valid batch class identifier This parameter used for fetching the information of the document for defined document type
hocrFile This value should not and empty and should have same name as HOCR file attached for processing. This parameter is used for verifying the HOCR file name.

 

Web Service URL: http://{serverName}:{port}/dcma/rest/extractFuzzyDB

 

CheckList:-

  1. hocrFile should have same HOCR file name that are passed for processing.
  2. BatchClass having that batchClassIdentifier should have fuzzyDB plugin configured for processing.
  • DocumentType should have document level fields for specified document type.

 

Sample client code using apache commons http client:-

private static void extractFuzzyDB() {
		HttpClient client = new HttpClient();
		String url = "http://localhost:8080/dcma/rest/extractFuzzyDB";
		PostMethod mPost = new PostMethod(url);
		// Adding HOCR file for processing
		File file = new File("C:\\sample\\US-Invoice_HOCR.xml");
		Part[] parts = new Part[4];
		try {
			parts[0] = new FilePart(file.getName(), file);
			// Adding parameter for docuement type.
			String documentType = "US Invoice";
			parts[1] = new StringPart("documentType", documentType);
			// Adding parameter for batch class.
			String batchClassIdentifier = "BC5";
			parts[2] = new StringPart("batchClassIdentifier", batchClassIdentifier);
			parts[3] = new StringPart("hocrFile", file.getName());
			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.");
				String responseBody = mPost.getResponseBodyAsString();
				// Generating result as responseBody.
				System.out.println(statusCode + " *** " + responseBody);
			} else if (statusCode == 403) {
				System.out.println("Invalid username/password.");
			} else {
				System.out.println(mPost.getResponseBodyAsString());
			}
		} catch (FileNotFoundException e) {
			System.err.println("File not found for processing.");
		} catch (HttpException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (mPost != null) {
				mPost.releaseConnection();
			}
		}
	}

Viewing all articles
Browse latest Browse all 478

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>