You are here: Catalog Elements > License Model > copyLicenseModel

Create Copy of License Model

Description

Creates new license model according to the updated fields.

The input of this Web service is the XML string returned by getLicenseModelById.xml. In the input XML, you can edit values of the following fields:

The change in the value of a tag other than those listed above will result in error.

Default Protocol Method Type URI
HTTPS POST copyLicenseModel.xml

POST Parameters

Parameter Description Valid Values Optional
detailsLM

The XML string returned by getLicenseModelById.

For on-premise applications deployed with feature level licensing, if you want to add a feature containing concurrent license model, you need to create a copy of concurrent license model with default counting type as 3. It means that you need to specify the Counting Type as 3 in the input XML, for concurrent license model.

String No

Sample Code

import java.io.IOException;
//..............................
//..............................
//..............................
import org.apache.http.params.HttpParams;
public class EMSSample {
	private static DefaultHttpClient httpclient = new DefaultHttpClient();
	private static Principal principal = null;
	//..............................
	//..............................
	//..............................
	public static String copyLicenseModel.xml()throws Exception {
		if(!verifyLogin()){
			return "login failed";
		}
		HttpContext context = new BasicHttpContext();
		context.setAttribute(ClientContext.USER_TOKEN, principal);
		HttpPost post =  new HttpPost("https://localhost:8080/ems/3.6/copyLicenseModel.xml");
		List<NameValuePair> nvps = new ArrayList<NameValuePair>();
		nvps.add(new BasicNameValuePair("detailsLM", ""));
		post.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
		HttpResponse response = httpclient.execute(post, context);
		HttpEntity entity = response.getEntity();
		byte[] b = null;
		if (entity != null) {
			long l = entity.getContentLength();
			b = new byte[(int) l];
			entity.getContent().read(b);
			entity.consumeContent();
		}
		return new String(b);
	}
}

Sample Response

<?xml version="1.0" encoding="UTF-8"?>
<emsResponse>
   <licenseModelId>5</licenseModelId>
   <stat>ok</stat>
</emsResponse>
See Also:

Output Format for Failure

Error Codes

Error Code Description
107 An internal error occurred! Please report the error to System administrator.
122 {field} is a required field and should have a not null value. [Note: This error code is applicable for the fields - Eid, namespaceName, featureName, startDate, endDate, userIds, featureId, productName, productVersion, detailsLM, lmId, templateType, customAttribute, lineItemId, customerRefId, granularity, loginId, oldPassword, and newPassword.]
413 LicenseModel <LicenseModel name> already exists. Try again with different name.
1043 XML schema Validation Failed.
1051 The attribute value {value} is not available in the predefined list of values. Provide a valid value only.
1081 Invalid Web service version provided
1084 No Web service version provided
1088 The EMS system is running on HTTPS. Please provide the correct Web service URL.
1134 Invalid capacity value.Capacity value between 1 - 2147483647 is allowed.
1190 The start date cannot be equal to the end date.