This API will create the document level fields for the document type for the specified batch class for barcode in the input tiff 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
imageName This value should not and empty. On this file extraction operation will be performed.

 

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

Sample XML file

 

<WebServiceParams>

<Params>

<Param>

<Name>batchClassIdentifier</Name>

<Value>BC5</Value>

</Param>

<Param>

<Name>imageName</Name>

<Value>US-Invoice.tif</Value>

</Param>

<Param>

<Name>docType</Name>

<Value>US Invoice</Value>

</Param>

</Params>

</WebServiceParams>

 

CheckList:-

  1. BatchClass having that batchClassIdentifier should have Barcode Extraction plugin for processing.
  2. DocumentType should have document level fields for specified document type.
  • Image name should have valid extension i.e. TIF/TIFF.

 

Sample client code using apache commons http client:-

private static void barcodeExtraction() {
		HttpClient client = new HttpClient();
		String url = "http://localhost:8080/dcma/rest/barcodeExtraction";
		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

Comments are closed.