• Welcome to KonaKart Community Forum. Please login or sign up.
 

Could not add Tags to Product using SOAP web services for KonakartAdmin

Started by Abhed, June 20, 2014, 02:29:06 pm

Previous topic - Next topic

Abhed

Hi,

I am creating portlets in Liferay and using SOAP webservices of konakart admin to create products in konakart .
I am not able to associate Tags with Product.
Below is the related code snippet to add Tags to Product.


/**
* Add Tags to Product
*/

AdminSearch adminSearchForTag = new AdminSearch();
adminSearchForTag.setLanguageId(adminLanguage.getId());
adminSearchForTag.setName("Tag1");
AdminTagSearchResult adminTagSearchResult = adminIf.getTags(sessionId, adminSearchForTag, 0, -1);
AdminTag[] adminTags = adminTagSearchResult.getTags();


try {
AdminEngineConfig adminEngineConfig = new AdminEngineConfig();
adminEngineConfig.setProperties(new String[] {"konakartadmin.webservice.URL", "http://localhost:8880/konakartadmin/services/KKWSAdmin", "customAdmin.webservice.URL", "http://localhost:8880/konakartadmin/services/KKWSCustomAdminService", "konakartadmin.webservice.timeoutSecs", "10"});
KKAdmin kkAdmin = new KKAdmin(adminEngineConfig);
AdminTagMgr adminTagMgr = new AdminTagMgr(kkAdmin);
adminTagMgr.addTagsToProduct(adminTags, productId);

} catch (KKAdminException e1) {
log.error(e1);
} catch (Exception e1) {
log.error(e1);
}


It throws error while initializing KKAdmin.

[b]KKAdmin kkAdmin = new KKAdmin(adminEngineConfig);[/b]


The error is
Quotejava.lang.NoClassDefFoundError for com.konakart.util.PropertyFileNames
[/b][/i]

I have already added the konakart_utils.jar as a dependency. But the class in error is not there in that jar, and I am not able to find it in any of the jars from konakart. I have also searched in all the jars from konakart and konakartadmin webapp library. But couldn't found the class.

Please correct me, if I am implementing it in wrong way. Specially the initialization of KKAdmin. It might need any other properties, or should I simply feed it with konakart.properties or konakartadmin.properties ?
In any case, the error reported has hardly anything to do with any missing property.

Any help or guidance is a welcome.

thanks,
Abhed

ming


Wherever you can, always use the APIs on KKAdminIf rather than instantiating the Mgr and using those internal methods.

So for adding tags use this:

addTagsToProduct
void addTagsToProduct(java.lang.String sessionId,
                      AdminTag[] tags,
                      int productId)
                      throws KKAdminException
Add the array of AdminTags to the product identified by productId. We assume that the product and the tags already exist in the database since this method inserts an association between a tag and a product rather than the actual objects.

Parameters:sessionId - session Id of logged in Admin usertags - Array of AdminTag objectsproductId - The id of the product Throws: KKAdminException

Abhed

Hello Ming,

Thank you for clues. I am able to achieve it through KKWSAdmin.addTagsToProduct method.

regards,
Abhed