java - 无法调用远程端点 alexa

标签 java web-services tomcat https amazon-echo

我正在尝试开发一种 alexa 技能,它与我自己的网络服务 (tomcat) 进行通信。为了设置项目,我遵循了亚马逊指南 (https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/deploying-a-sample-skill-as-a-web-service)。

现在我仍然无法连接到 web 服务,只收到消息“无法调用远程端点,或者它返回的响应无效”。

服务托管于 https://ec2-54-159-167-123.compute-1.amazonaws.com/PiaServer并且可以通过 https 访问。我使用了自签名证书。我按照文档中的说明进行了所有操作,但仍然无法连接。根本没有tomcat日志。

我的端点是来自亚马逊 java-skill-kit 的 speechletServlet。

当我通过 Postman(Chrome 插件)发出请求时,我得到了一个完美的 JSON 响应(见下文):

{ "version": "1.0", "response": { "outputSpeech": {"type":"PlainText", "text": "text" }, "card": { "type": "Simple", "title":`enter code here`"Tank", "content": "text" }, "shouldEndSession": true } }

你有什么解决办法吗?

编辑:我在 Amazon EC2 上托管该服务。

最佳答案

我今天遇到了同样的问题,但是使用了有效的 Let's encrypt 证书:

The remote endpoint could not be called, or the response it returned was invalid.

Alexa Service Simulator with "The remote endpoint could not be called, or the response it returned was invalid" as the service response

在我的例子中,“无法调用远程端点”错误的原因是 SSL 证书配置。

因为我的端点有有效的 Let's Encrypt 证书,所以我假设我必须选择 🔘 我的开发端点有来自受信任的证书颁发机构的证书 选项。

但是那没有用。该请求甚至没有到达网络服务器。

Alexa SSL Certificate configuration that leads to an "remote endpoint could not be called" error

当您选择 🔘 我的开发端点是一个域的子域时,该域具有来自证书颁发机构的通配符证书,它将起作用。

Working Alexa Skill SSL Configuration

我使用 Runscope 作为透明代理来调试我的 Alexa 端点。如果您将 SSL 配置更改为“我的开发端点是具有通配符证书的域的子域”,您可以在流量检查器中看到请求:

Alexa request in the Runscope traffic inspector

但我无法解释为什么第一个选项不起作用而第二个选项起作用。

起初我怀疑这与SNI有关,但事实并非如此。我检查了为这两个选项发送的数据包,在这两种情况下,亚马逊都在 SSL Client Hello 中发送了 server_name

关于java - 无法调用远程端点 alexa,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40467695/

相关文章:

java - JLabels 没有显示

java - UTF-8 字符未显示

Java 2d 游戏关键听众时间限制

javascript - 如何从 JavaScript 调用 REST Web 服务 API?

java - android 在 TextWatcher 中更改 autocompletetextview 适配器

java - 如何使用 Java 启动和停止 Tomcat 容器?

java - 在Java中删除csv文件的内容

web-services - 如何显示从jquery.ajax()检索到的xml文档的内容...?

tomcat - Google Cloud VM 实例如何打开 IP 转发

rest - Glassfish 与 Tomcat 的 RESTful 服务对比