2016-06-30 38 views
1

我試圖從OpenWhisk動作調用包含到Watson系統包(文本到語音)中的動作。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 
} 

你能幫助理解我做錯了什麼嗎?

回答

2

該操作的名稱應完全限定爲包含該命名空間。從您的CLI輸出中,它看起來像您的軟件包是/xxxxxx/myWatson,因此您在whisk.invoke中的操作參考應爲/xxxxxx/myWatson/textToSpeech

相關問題