There can be situations where a Service exposed as an OSGI component needed to be called directly from a Jaggery app, without exposing the srvice as a RESTful service. This is pretty simple and all it takes is the following snippet.
var carbon = require('carbon'); var datasetService = carbon.server.osgiService('org.wso2.carbon.ml.dataset.DatasetService'); where "org.wso2.carbon.ml.dataset.DatasetService" is the full class path of the class exposed as the OSGI service. Then any method in the service can simply be called as follows.
datasetService.getDatasetUploadingDir();
Wrote by Supun Setunga