You are here: Catalog Elements > Product > createProduct

Create Product

Description

Creates a new product for the specified namespace containing the given features.

Default Protocol Method Type URI

HTTPS

POST

createProduct.xml

Post Parameters

Parameter Description Valid Values Optional

namespaceName

Specify the namespace to which the product belongs.

String

No

productName

Specify the name of the product to be created.

String

No

productVersion

Specify the version of the product to be created.

String

No

productDescription

Description of the product.

String

Yes

ftrIds

Specify unique record IDs of features (as stored tin EMS database) to be associated with this product.

String (comma separated integers)

Yes

refId1

Information that uniquely identifies the Product in a different system, for example, a Product ID in your company's ERP system.

String

Yes

refId2

A second unique reference ID, similar to Ref ID 1.

String

Yes

serviceAgreementID

Unique identifier of the product agreement.

Integer

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 createProduct.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/createProduct.xml");
                List<NameValuePair> nvps = new ArrayList<NameValuePair>();
                nvps.add(new BasicNameValuePair("refId2", ""));
                nvps.add(new BasicNameValuePair("namespaceName", ""));
                nvps.add(new BasicNameValuePair("serviceAgreementID", ""));
                nvps.add(new BasicNameValuePair("productDescription", ""));
                nvps.add(new BasicNameValuePair("refId1", ""));
                nvps.add(new BasicNameValuePair("productVersion", ""));
                nvps.add(new BasicNameValuePair("productName", ""));
                nvps.add(new BasicNameValuePair("featureIds", ""));
                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>
   <productId>20</productId> 
   <stat>ok</stat>
</emsResponse>
See Also:

Output Format for Failure

Error Codes

Error Code

Description

100

Invalid request parameter.

101

You are not authorized to use this service.

107

An internal error occurred! Please report the error to System administrator.

115

Length of {field} is {actual value}. It cannot be more Than {max value}. [Note: This error code is applicable for the fields - billAddr, billAddrCity, billAddrCountry, billAddrState, billAddrZip, shipAddr, shipAddrCity, shipAddrCountry, shipAddrState, shipAddrZip, refId1, refId2, contactPassword, description, and default value.]

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.]

128

You should log on first.
132 The URL address does not exist.

133

Invalid namespace.

305

Mentioned feature id should belong to same Namespace As product.

309

Unable to find feature.

312

Product “${productname}” already exists. Please try again with different name and version.

1011

Service Agreement not found.

1025

ftrId(s) should be of type integer.
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.