-->

Watson Speech-to-Text register_callback returns on

2019-07-25 11:06发布

问题:

The Watson Speech-to-Text asynchronous HTTP interface allows one to register a callback url through a call to register_callback. This call is clearly not working; for illustration, please see these six lines of code.

# 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.

I first call register_callback with a perfectly valid callback_url parameter, in exactly the way the documentation describes. This call returns with a 400 and, according to my callback URL server logs, the callback URL never receives an HTTP request. Then I GET the callback URL myself with a challenge_string. Not only is the callback URL responding with the right output, but a log appears on my server indicating the URL received an HTTP request. I conclude that register_call is not working.

回答1:

Answer:

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.

Also FYI:

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.



回答2:

we just fixed the issue you reported. The problem was on our end, the servers responsible for making the callback to the server you set up did not support the cipher suites needed for establishing the SSL connection. We just updated the servers and we are happy to learn that it is now working for you: )

Dani