我可以使用DevOps IDE调用我的工作流程,但不能使用Node.js应用程序调用我的工作流程。我的Node.js应用代码是:
var buffer = new Buffer(workflowConfig.credentials.user + ":" + workflowConfig.credentials.password,"ascii");
var base64Auth = buffer.toString('base64');
var baseURL = workflowConfig.credentials.url.substr(0, workflowConfig.credentials.url.lastIndexOf('/'));
var scriptFilepath = 'helloworld';
var wfTarget = 'echo';
var APIUrl = urljoin(baseURL, 'myworkflow', scriptFilepath, '_', wfTarget);
var requestOptions = {
headers : {
"Authorization" : base64Auth
}
}
console.log("APIUrl: " + APIUrl);
console.log("requestOptions: " + JSON.stringify(requestOptions));
request.get(APIUrl, requestOptions, function(error, response, body){
if (error) {
console.log(error);
res.status(500).send(error)
}else{
console.log(body);
res.json(body);
}
});
我尝试在Bluemix和我的本地环境(使用硬编码的VCAP_SERVICES)上运行它。响应正文是一个HTML页面,标题为:"重定向到OP"
请帮助