var invokeRetrieveArtifactId = function (applicationKey,version,revision){
var ws = require('ws');
var retrieveArtifactIdProcess = new ws.WSRequest();
var options = new Array();
options.useSOAP = 1.1;
options.action = "urn:retrieveArtifactId";
options["HTTPHeaders"] = [ { name : "Cookie", value :modManager.getAdminCookie() }];
var payload = '<p:RetrieveArtifactIdRequest xmlns:p="http://retrieve.core.appfactory.carbon.wso2.org"><p:applicationId>'+applicationKey+'</p:applicationId><p:version>'+version+'</p:version><p:revision>'+revision+'</p:revision></p:RetrieveArtifactIdRequest>';
var result;
try {
var endPoint =getProperty('ServerUrls.AppFactory')+'RetrieveArtifactService'; // provide the endpoint
retrieveArtifactIdProcess.open(options,endPoint, false);
retrieveArtifactIdProcess.send(payload);
result = retrieveArtifactIdProcess.responseE4X;
var resultNS = new Namespace("http://retrieve.core.appfactory.carbon.wso2.org");
var artifactDetails = result.resultNS::["return"].text()
if(log.isDebugEnabled()){
log.debug("Invoking service endpoint:"+endPoint+" returned result:"+result);
}
return artifactDetails;
} catch (e) {
log.error("Error while retrieving the artifact id"+applicationKey + "\n"+e.message);
throw "Error while retrieving the artifact id"+applicationKey;
}
}
No comments:
Post a Comment