OpenWhisk从动作

时间:2016-06-30 20:34:14

标签: node.js text-to-speech ibm-watson openwhisk

我正在尝试从OpenWhisk操作中调用包含在Watson系统包(文本到语音)中的操作。

我已经绑定了服务并设置了凭据,因此从CLI我可以看到

wsk list
entities in namespace: xxxxxx
packages
/xxxxxx/myWatson                           private binding

这是我的OpenWhisk行动:

function main(param) {
   //code here for my action. At the end, I invoke the text to speech        

   if (...) {
      textToSpeech(param.text);
    }
    else {
        return whisk.error(error);
    }
    return whisk.async();
}

function textToSpeech(text){
    whisk.invoke({
      name:'myWatson/textToSpeech',
      parameters:{
        payload: text,
        voice: 'en-US_MichaelVoice',
        accept: 'audio/wav',
        encoding: 'base64'
      },
      blocking: true,
      next: function(error, activation){
        if(error){
            return whisk.error(error);
        }
        else{
            return whisk.done({msg:'success'});
        }
      }
   });
}

我收到以下错误

"response": {
    "result": {
        "error": "The requested resource does not exist. (undefined)"
    },
    "status": "application error",
    "success": false
}

你能帮助理解我做错了吗?

1 个答案:

答案 0 :(得分:2)

操作的名称应完全限定以包含命名空间。从您的CLI输出看,您的软件包看起来像/xxxxxx/myWatson,因此whisk.invoke中的操作引用应为/xxxxxx/myWatson/textToSpeech

相关问题