This Web Service API is used to copy an existing document type for a batch class to create new document type. It takes an XML as input containing information of the batch class, Existing Document type Name, New Document type name its Description and confidence threshold and output of this API is new document type in line with existing document type for the mentioned batch class.

Request Method: POST

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

Input Parameters for the Web Service is as follows:

Input Parameter Values Descriptions
BATCH_CLASS_ID It should contain a value of an existing batch Class Identifier.Eg BC1 The identifier of the Batch Class whose document type is to be copied.
EXISTING_DOC_TYPE_NAME This should be a non-empty Value containing existing document type name.Eg. US Invoice This parameter should contain name of document type of the Batch Class Identifier
which is to be copied.
NEW_DOC_TYPE_NAME This value should be unique name for new document type to be created.Eg. Us Invoice Copy This parameter should unique name for new document type which is to be created.
NEW_DOC_TYPE_DESCRIPTION This value should be unique description for the new document type to be created. This parameter should unique description for new document type which is to be created.
CONFIDENCE_THRESHOLD Values should be between 0.0 and 100.0 inclusive of both values. This parameter should contain confidence threshold value, between 0 and 100 for new document type.

 

Sample Input XML:

<Copy_Document_Type>

<Batch_Class_Id>BC8</Batch_Class_Id>

<Existing_Doc_Type_Name>AsiSeparatorPage</Existing_Doc_Type_Name>

<New_Document_Type>

<Name>test2</Name>

<Description>test2 Description</Description>

<Confidence_Threshold>10</Confidence_Threshold>

</New_Document_Type>

</Copy_Document_Type>

 

Sample client code using apache commons http client:-

private static void copyDocumentType() {
		HttpClient client = new HttpClient();
		String url = "http://localhost:8080/dcma/rest/batchClass/copyDocumentType";
		PostMethod mPost = new PostMethod(url);

		// Adding Input XML file for processing
		File file = new File("C:\\sample\\sample.xml");

		Part[] parts = new Part[1];
		try {
		parts[0] = new FilePart(file.getName(), file);
		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();
		}
		}
} 

Was this article helpful to you?

Engineering

Comments are closed.