This API helps to decrypt the HOCR file present in lucene-search-classification-sample within the batch class folder located in the Shared Folders.
Web Service URL: http://{serverName}:{port}/dcma/rest/decryptLuceneClassificationHocrXml
Request Method: POST
Input Parameters
Input Parameter | Value | Description |
hocrFileName | An HOCR.xml file to be decrypted | File name must be a valid hocr file |
batchClassIdentifier | Batch class identifier ( BC1) | A valid batch class identifier |
pageType |
|
Page type has to be a valid type to be selected among the three given type |
documentType | Document type( US Invoice) | A valid document type is expected |
Sample client code using apache commons http client:-
private static void decryptLuceneClassificationHocrXml() { HttpClient client = new HttpClient(); String url = "http://localhost:8080/dcma/rest/decryptLuceneClassificationHocrXml"; PostMethod mPost = new PostMethod(url); mPost.setDoAuthentication(true); // Input zip file for importing batch class. Part[] parts = new Part[4]; try { parts[0] = new StringPart("hocrFileName", "US-Invoice_HOCR.xml"); parts[1] = new StringPart("batchClassIdentifier", "BC5"); parts[2] = new StringPart("pageType", "First"); parts[3] = new StringPart("documentType", "US Invoice"); MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams()); mPost.setRequestEntity(entity); int statusCode = client.executeMethod(mPost); if (statusCode == 200) { System.out.println("HOCR XML decrypted successfully"); String responseBody = mPost.getResponseBodyAsString(); 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.out.println("File not found for processing."); } catch (HttpException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (mPost != null) { mPost.releaseConnection(); } } }