This API will create the copy of an existing batch class whose identifier is provided as input/source. Other parameters required for the batch class creation are as follows:

Request Method POST

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

Input Parameter Values Descriptions
batchClassName The Name of batch class should not be empty or contains characters like space(“ “) or hyphen(“-“) and should not be more than 255 characters. The unique character is used for naming the new copied batch class.
batchClassDescription This should be a non-empty Value This parameter is the description of the new copied batch class.
batchClassPriority The batch class priority cannot be null or empty and should be between 1 and 100 inclusive of both. The priority of the batch class.
batchUNCFolder The UNC folder name for the batch class. This UNC folder name for the new copied batch class.
copyBatchClassIdentifier This value should be non-empty and a preexisting Batch Class Idenitifer The identifier of the Batch Class which is used as reference for copying.
gridWorkflow Can be true or false States the workflow, is the batch class deployed as grid workflow or normal workflow.

 

Sample Input XML:


<WebServiceParams>

 

<Params>

 

<Param>

 

<Name>batchClassName</Name>

 

<Value>AsiDocTypeClasTem_ticket_copy222</Value>

 

</Param>

 

<Param>

 

<Name>batchClassDescription</Name>

 

<Value>AsiDocTypeClasTem_ticket</Value>

 

</Param>

 

<Param>

 

<Name>batchClassPriority</Name>

 

<Value>1</Value>

 

</Param>

 

<Param>

 

<Name>batchUNCFolder</Name>

 

<Value>/opt/Ephesoft/SharedFolders/Copy_BC12</Value>

 

</Param>

 

<Param>

 

<Name>copyBatchClassIdentifier</Name>

 

<Value>BC4</Value>

 

</Param>

 

<Param>

 

<Name>gridWorkflow</Name>

 

<Value>FALSE</Value>

 

</Param>

 

</Params>

 

</WebServiceParams>

 

Note: Values highlighted in blue should be replaced with corresponding values while executing the Web service for copying an existing batch Class.

 

Sample client code using apache commons http client:-

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