Watson Speech-to-Text register_callback returns 只有 400 秒

Watson Speech-to-Text register_callback returns only 400s

Watson Speech-to-Text asynchronous HTTP interface 允许通过调用 register_callback 注册回调 url。这个电话显然不起作用;为了说明,请看这六行代码。

# Illustration of how I can't get the Watson Speech-to-Text
# register_callback call to work.

r = requests.post(
    "https://stream.watsonplatform.net/speech-to-text/api/v1/register_callback?{0}".format(
        urllib.urlencode({ "callback_url": callback_url })),
    auth=(watson_username, watson_password),
    data="{}")

print(r.status_code)
print(pprint.pformat(r.json()))

# This outputs:

# 400
# {u'code': 400,
#  u'code_description': u'Bad Request',
#  u'error': u"unable to verify callback url 'https://xuyv2beqpj.execute-api.us-east-1.amazonaws.com/prod/SpeechToTextCallback' , server responded with status code: 400"}

# and no http call is logged on the server.

r = requests.get(
    callback_url, params=dict(challenge_string="what does redacted mean?"))

print(r.status_code)
print(r.text)

# This outputs:

# 200
# what does redacted mean?

# and an HTTP GET is logged on the server.

我首先使用完全有效的 callback_url 参数调用 register_callback,完全按照文档描述的方式。此调用 returns 返回 400,根据我的回调 URL 服务器日志,回调 URL 从未收到 HTTP 请求。然后我 GET 回调 URL 自己用 challenge_string。不仅回调 URL 以正确的输出响应,而且我的服务器上还会出现一条日志,表明 URL 收到了一个 HTTP 请求。我的结论是 register_call 不起作用。

答案:

We identified the issue on our end: the server that makes the outbound calls to your URL did not support the SSL encryption method that your callback server uses. We have fixed that and we are in the process of pushing to the production environment very soon.

另供参考:

The error message with 400 indicates the callback URL does not meet request or does not exist. Please refer to the detail in Speech-To-Text service API document, http://www.ibm.com/watson/developercloud/speech-to-text/api/v1/?curl#register_callback

If the service does not receive a response with a response code of 200 and a body that echoes a random alphanumeric challenge string from the callback URL within 5 seconds, it does not whitelist the URL; it sends response code 400 in response to the registration request.

我们刚刚解决了您报告的问题。问题出在我们这边,负责对您设置的服务器进行回调的服务器不支持建立 SSL 连接所需的密码套件。我们刚刚更新了服务器,我们很高兴得知它现在可以为您服务:)

丹妮