简体   繁体   English

设置alexa服务器Hello World演示

[英]Setting up an alexa server hello world demo

I am trying to set up the demo hello world alexa skill on my own server (A raspberry pi). 我正在尝试在自己的服务器(树莓派)上设置演示hello world alexa技能。 I have tried this on a mac and it works. 我已经在Mac上尝试过了,并且可以正常工作。

I am following these instructions : https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/deploying-a-sample-skill-as-a-web-service 我正在按照以下说明进行操作: https : //developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/deploying-a-sample-skill-as-a-web-service

We are using alexa-skills-kit-1.4.0.jar, and a non-self signed https certificate. 我们正在使用alexa-skills-kit-1.4.0.jar和一个非自签名的https证书。

The server runs, and we can test it using curl, from an external server. 服务器正在运行,我们可以使用curl从外部服务器进行测试。 However if I test from the alexa website the server gives the error: 但是,如果我从alexa网站进行测试,则服务器会显示错误消息:

Error "Caused by: java.io.IOException: Connection reset by peer" with hello world java example (external server)

This is the request we are sending with curl which works: 这是我们通过curl发送的请求,该请求有效:

curl -v https://samneaves.ddns.net:443/hello --data-binary '{   
>  "session": {
>  "sessionId": "SessionId.1f8a866f-1c47-439e-9e80-9811319a6b69",
>  "application": {
>  "applicationId": "amzn1.ask.skill.bda1b928-bb31-4751-92a1-51594baa0545"
>  },   
>  "attributes": {},
>  "user": {
>
  "userId": 
"amzn1.ask.account.AFSSQO63BZIPWAZGAPT4MST2DM5GHYQA3BGVVEUJJ6XS2C4V4H5V33J446YEQIE4FKHHEBT6UL3SAIRGNJWWHSOCEO4VY6EI3CL3ZQTCLCFZCEEXGMOIMYUYZNBHST5WY2MNMLEAMD2TJRVKTPGUEMJ4GOSZRTZWEUJRAH7FVOVB7TI6VM4MFATTBEZGY5NUWRBUKEWIHCE5H7I"
>  },   
>  "new": true
>  },
>  "request": {
>  "type": "IntentRequest",
>  "requestId": "EdwRequestId.0063cee4-affc-4ea8-8be0-0ff9106fe93b",
>  "locale": "en-GB",
>  "timestamp": "2017-08-04T18:16:46Z",
>  "intent": {
>  "name": "HelloWorldIntent",
>  "slots": {}
>  }
>  },
>  "version": "1.0"
> }'
*  Trying 82.38.154.2...
* Connected to samneaves.ddns.net (82.38.154.2) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
* Server certificate: samneaves.ddns.net
* Server certificate: Let's Encrypt Authority X3
* Server certificate: DST Root CA X3
> POST /hello HTTP/1.1
> Host: samneaves.ddns.net
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Length: 818
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 818 out of 818 bytes
< HTTP/1.1 200 OK
< Content-Type: application/json
< Content-Length: 181
< Server: Jetty(9.0.6.v20130930)
< 
* Connection #0 to host samneaves.ddns.net left intact
{"version":"1.0","response":{"outputSpeech":{"type":"PlainText","text":"Hello
 world"},"card":{"type":"Simple","title":"HelloWorld","content":"Hello 
world"},"shouldEndSession":true}}

However, when sending a request from the alexa test we get the error "The remote endpoint could not be called, or the response it returned was invalid." 但是,从alexa测试发送请求时,出现错误“无法调用远程端点,或者它返回的响应无效”。

And the log output on the server is: 服务器上的日志输出为:

1455213 [qtp17573111-10-acceptor-0-ServerConnector@eb1874{SSL-HTTP/1.1}{0.0.0.0:443}] DEBUG org.eclipse.jetty.io.SelectorManager  - Queued change org.eclipse.jetty.io.SelectorManager$ManagedSelector$Accept@4ae411
1455219 [qtp17573111-11-selector-0] DEBUG org.eclipse.jetty.io.SelectorManager  - Selector loop woken up from select, 0/0 selected
1455224 [qtp17573111-11-selector-0] DEBUG org.eclipse.jetty.io.SelectorManager  - Running change org.eclipse.jetty.io.SelectorManager$ManagedSelector$Accept@4ae411
1455263 [qtp17573111-11-selector-0] DEBUG org.eclipse.jetty.io.AbstractEndPoint  - onOpen SelectChannelEndPoint@d78553{/72.21.217.99:21194<r-l>/192.168.0.5:443,o=true,is=false,os=false,fi=FillInterest@1722b59{false,null},wf=WriteFlusher@7c1624{IDLE},it=30000}{null}{io=0,kio=0,kro=0}
1455302 [qtp17573111-11-selector-0] DEBUG org.eclipse.jetty.io.IdleTimeout  - SelectChannelEndPoint@d78553{/72.21.217.99:21194<r-l>/192.168.0.5:443,o=true,is=false,os=false,fi=FillInterest@1722b59{false,null},wf=WriteFlusher@7c1624{IDLE},it=30000}{null}{io=0,kio=0,kro=0} idle timeout check, elapsed: 37 ms, remaining: 29963 ms
1456864 [qtp17573111-11-selector-0] DEBUG org.eclipse.jetty.io.IdleTimeout  - DecryptedEndPoint@10d29b5{/72.21.217.99:21194<r-l>/192.168.0.5:443,o=true,is=false,os=false,fi=FillInterest@12d3e1a{false,null},wf=WriteFlusher@1484698{IDLE},it=30000}{null}->SelectChannelEndPoint@d78553{/72.21.217.99:21194<r-l>/192.168.0.5:443,o=true,is=false,os=false,fi=FillInterest@1722b59{false,null},wf=WriteFlusher@7c1624{IDLE},it=30000}{null}{io=0,kio=0,kro=0} idle timeout check, elapsed: 1 ms, remaining: 29999 ms
1456889 [qtp17573111-11-selector-0] DEBUG org.eclipse.jetty.server.HttpConnection  - New HTTP Connection HttpConnection@12df42{IDLE},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0}
1457229 [qtp17573111-11-selector-0] DEBUG org.eclipse.jetty.io.AbstractConnection  - onOpen SslConnection@ff86eb{NEED_UNWRAP,eio=-1/-1,di=-1} -> HttpConnection@12df42{IDLE},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0}
1457257 [qtp17573111-11-selector-0] DEBUG org.eclipse.jetty.io.AbstractConnection  - onOpen HttpConnection@12df42{IDLE},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0}
1457281 [qtp17573111-11-selector-0] DEBUG org.eclipse.jetty.io.AbstractConnection  - fillInterested HttpConnection@12df42{IDLE},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0}
1457313 [qtp17573111-11-selector-0] DEBUG org.eclipse.jetty.io.AbstractConnection  - fillInterested SslConnection@ff86eb{NEED_UNWRAP,eio=-1/-1,di=-1} -> HttpConnection@12df42{INTERESTED},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0}
1457385 [qtp17573111-11-selector-0] DEBUG org.eclipse.jetty.io.SelectChannelEndPoint  - Local interests updated 0 -> 1 for SelectChannelEndPoint@d78553{/72.21.217.99:21194<r-l>/192.168.0.5:443,o=true,is=false,os=false,fi=FillInterest@1722b59{true,AC.ExReadCB@ff86eb},wf=WriteFlusher@7c1624{IDLE},it=30000}{SslConnection@ff86eb{NEED_UNWRAP,eio=-1/-1,di=-1} -> HttpConnection@12df42{INTERESTED},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0}}{io=1,kio=0,kro=0}
1457455 [qtp17573111-11-selector-0] DEBUG org.eclipse.jetty.io.SelectorManager  - Created SelectChannelEndPoint@d78553{/72.21.217.99:21194<r-l>/192.168.0.5:443,o=true,is=false,os=false,fi=FillInterest@1722b59{true,AC.ExReadCB@ff86eb},wf=WriteFlusher@7c1624{IDLE},it=30000}{SslConnection@ff86eb{NEED_UNWRAP,eio=-1/-1,di=-1} -> HttpConnection@12df42{INTERESTED},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0}}{io=1,kio=0,kro=0}
1457460 [qtp17573111-11-selector-0] DEBUG org.eclipse.jetty.io.SelectorManager  - Running change org.eclipse.jetty.io.SelectChannelEndPoint$1@1f2ba18
1457465 [qtp17573111-11-selector-0] DEBUG org.eclipse.jetty.io.SelectChannelEndPoint  - Key interests updated 0 -> 1
1457469 [qtp17573111-11-selector-0] DEBUG org.eclipse.jetty.io.SelectorManager  - Selector loop waiting on select
1457474 [qtp17573111-11-selector-0] DEBUG org.eclipse.jetty.io.SelectorManager  - Selector loop woken up from select, 1/1 selected
1457478 [qtp17573111-11-selector-0] DEBUG org.eclipse.jetty.io.SelectChannelEndPoint  - Key interests updated 1 -> 0
1457548 [qtp17573111-11-selector-0] DEBUG org.eclipse.jetty.io.SelectChannelEndPoint  - Local interests updated 1 -> 0 for SelectChannelEndPoint@d78553{/72.21.217.99:21194<r-l>/192.168.0.5:443,o=true,is=false,os=false,fi=FillInterest@1722b59{true,AC.ExReadCB@ff86eb},wf=WriteFlusher@7c1624{IDLE},it=30000}{SslConnection@ff86eb{NEED_UNWRAP,eio=-1/-1,di=-1} -> HttpConnection@12df42{INTERESTED},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0}}{io=0,kio=0,kro=1}
1457553 [qtp17573111-11-selector-0] DEBUG org.eclipse.jetty.io.SelectorManager  - Running change org.eclipse.jetty.io.SelectChannelEndPoint$1@1f2ba18
1457620 [qtp17573111-11-selector-0] DEBUG org.eclipse.jetty.io.ssl.SslConnection  - onFillable enter SelectChannelEndPoint@d78553{/72.21.217.99:21194<r-l>/192.168.0.5:443,o=true,is=false,os=false,fi=FillInterest@1722b59{false,null},wf=WriteFlusher@7c1624{IDLE},it=30000}{SslConnection@ff86eb{NEED_UNWRAP,eio=-1/-1,di=-1} -> HttpConnection@12df42{INTERESTED},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0}}{io=0,kio=0,kro=1}
1457639 [qtp17573111-11-selector-0] DEBUG org.eclipse.jetty.util.thread.QueuedThreadPool  - qtp17573111{STARTED,8<=8<=200,i=6,q=0} dispatched AC.ExReadCB@12df42
1457683 [qtp17573111-13] DEBUG org.eclipse.jetty.server.HttpConnection  - HttpConnection@12df42{FILLING},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0} onFillable org.eclipse.jetty.server.HttpChannelState@97afe5@IDLE,initial
1457741 [qtp17573111-13] DEBUG org.eclipse.jetty.io.ssl.SslConnection  - SslConnection@ff86eb{NEED_UNWRAP,eio=-1/-1,di=-1} -> HttpConnection@12df42{FILLING},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0} fill enter
1457772 [qtp17573111-11-selector-0] DEBUG org.eclipse.jetty.io.ssl.SslConnection  - onFillable exit SelectChannelEndPoint@d78553{/72.21.217.99:21194<r-l>/192.168.0.5:443,o=true,is=false,os=false,fi=FillInterest@1722b59{false,null},wf=WriteFlusher@7c1624{IDLE},it=30000}{SslConnection@ff86eb{NEED_UNWRAP,eio=-1/-1,di=-1} -> HttpConnection@12df42{FILLING},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0}}{io=0,kio=0,kro=1}
1457788 [qtp17573111-11-selector-0] DEBUG org.eclipse.jetty.io.SelectorManager  - Selector loop waiting on select
1457833 [qtp17573111-13] DEBUG org.eclipse.jetty.io.ChannelEndPoint  - filled 223 SelectChannelEndPoint@d78553{/72.21.217.99:21194<r-l>/192.168.0.5:443,o=true,is=false,os=false,fi=FillInterest@1722b59{false,null},wf=WriteFlusher@7c1624{IDLE},it=30000}{SslConnection@ff86eb{NEED_UNWRAP,eio=18209/-1,di=-1} -> HttpConnection@12df42{FILLING},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0}}{io=0,kio=0,kro=1}
1457865 [qtp17573111-13] DEBUG org.eclipse.jetty.io.ssl.SslConnection  - SslConnection@ff86eb{NEED_UNWRAP,eio=223/-1,di=-1} -> HttpConnection@12df42{FILLING},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0} filled 223 encrypted bytes
1457898 [qtp17573111-13] DEBUG org.eclipse.jetty.io.ssl.SslConnection  - SslConnection@ff86eb{NEED_TASK,eio=0/-1,di=-1} -> HttpConnection@12df42{FILLING},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0} unwrap Status = OK HandshakeStatus = NEED_TASK
bytesConsumed = 223 bytesProduced = 0
1458193 [qtp17573111-13] DEBUG org.eclipse.jetty.io.ChannelEndPoint  - filled 0 SelectChannelEndPoint@d78553{/72.21.217.99:21194<r-l>/192.168.0.5:443,o=true,is=false,os=false,fi=FillInterest@1722b59{false,null},wf=WriteFlusher@7c1624{IDLE},it=30000}{SslConnection@ff86eb{NEED_WRAP,eio=18432/-1,di=-1} -> HttpConnection@12df42{FILLING},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0}}{io=0,kio=0,kro=1}
1458226 [qtp17573111-13] DEBUG org.eclipse.jetty.io.ssl.SslConnection  - SslConnection@ff86eb{NEED_WRAP,eio=0/-1,di=-1} -> HttpConnection@12df42{FILLING},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0} filled 0 encrypted bytes
1458259 [qtp17573111-13] DEBUG org.eclipse.jetty.io.ssl.SslConnection  - SslConnection@ff86eb{NEED_WRAP,eio=0/-1,di=-1} -> HttpConnection@12df42{FILLING},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0} unwrap Status = OK HandshakeStatus = NEED_WRAP
bytesConsumed = 0 bytesProduced = 0
1458293 [qtp17573111-13] DEBUG org.eclipse.jetty.io.ssl.SslConnection  - SslConnection@ff86eb{NEED_WRAP,eio=0/-1,di=-1} -> HttpConnection@12df42{FILLING},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0} flush enter [java.nio.HeapByteBuffer[pos=0 lim=0 cap=0]]
1458325 [qtp17573111-13] DEBUG org.eclipse.jetty.io.ssl.SslConnection  - SslConnection@ff86eb{NEED_UNWRAP,eio=0/15864,di=-1} -> HttpConnection@12df42{FILLING},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0} wrap Status = OK HandshakeStatus = NEED_UNWRAP
bytesConsumed = 0 bytesProduced = 2568
1458442 [qtp17573111-13] DEBUG org.eclipse.jetty.io.ssl.SslConnection  - DecryptedEndPoint@10d29b5{/72.21.217.99:21194<r-l>/192.168.0.5:443,o=true,is=false,os=false,fi=FillInterest@12d3e1a{false,null},wf=WriteFlusher@1484698{IDLE},it=30000}{HttpConnection@12df42{FILLING},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0}}->SelectChannelEndPoint@d78553{/72.21.217.99:21194<r-l>/192.168.0.5:443,o=true,is=false,os=false,fi=FillInterest@1722b59{false,null},wf=WriteFlusher@7c1624{IDLE},it=30000}{SslConnection@ff86eb{NEED_UNWRAP,eio=0/2568,di=-1} -> HttpConnection@12df42{FILLING},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0}}{io=0,kio=0,kro=1} OK HeapByteBuffer@9ce6c4[p=0,l=2568,c=18432,r=2568]={<<<���|����M��Y��>��...��D����4[�B����>>>™©��...™©}
1458508 [qtp17573111-13] DEBUG org.eclipse.jetty.io.ChannelEndPoint  - close SelectChannelEndPoint@d78553{/72.21.217.99:21194<r-l>/192.168.0.5:443,o=false,is=false,os=false,fi=FillInterest@1722b59{false,null},wf=WriteFlusher@7c1624{IDLE},it=30000}{SslConnection@ff86eb{NEED_UNWRAP,eio=0/2568,di=-1} -> HttpConnection@12df42{FILLING},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0}}{io=0,kio=0,kro=1}
1458573 [qtp17573111-13] DEBUG org.eclipse.jetty.io.SelectorManager  - Destroyed SelectChannelEndPoint@d78553{/72.21.217.99:21194<r-l>/192.168.0.5:443,o=false,is=true,os=true,fi=FillInterest@1722b59{false,null},wf=WriteFlusher@7c1624{IDLE},it=30000}{SslConnection@ff86eb{NEED_UNWRAP,eio=0/2568,di=-1} -> HttpConnection@12df42{FILLING},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0}}{io=0,kio=-1,kro=-1}
1458595 [qtp17573111-13] DEBUG org.eclipse.jetty.io.AbstractConnection  - onClose HttpConnection@12df42{FILLING},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0}
1458627 [qtp17573111-13] DEBUG org.eclipse.jetty.io.AbstractConnection  - onClose SslConnection@ff86eb{NEED_UNWRAP,eio=0/2568,di=-1} -> HttpConnection@12df42{FILLING},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0}
1458692 [qtp17573111-13] DEBUG org.eclipse.jetty.io.AbstractEndPoint  - onClose SelectChannelEndPoint@d78553{/72.21.217.99:21194<r-l>/192.168.0.5:443,o=false,is=true,os=true,fi=FillInterest@1722b59{false,null},wf=WriteFlusher@7c1624{IDLE},it=30000}{SslConnection@ff86eb{NEED_UNWRAP,eio=0/2568,di=-1} -> HttpConnection@12df42{FILLING},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0}}{io=0,kio=-1,kro=-1}
1458724 [qtp17573111-13] DEBUG org.eclipse.jetty.io.ssl.SslConnection  - SslConnection@ff86eb{NEED_UNWRAP,eio=0/2568,di=-1} -> HttpConnection@12df42{FILLING},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0} flush exit, consumed 0
1458763 [qtp17573111-13] DEBUG org.eclipse.jetty.io.ssl.SslConnection  - SslConnection@ff86eb{NEED_UNWRAP,eio=-1/2568,di=-1} -> HttpConnection@12df42{FILLING},g=HttpGenerator{s=START},p=HttpParser{s=START,0 of 0} fill exit
1458766 [qtp17573111-13] DEBUG org.eclipse.jetty.server.HttpConnection  - 
org.eclipse.jetty.io.EofException
    at org.eclipse.jetty.io.ChannelEndPoint.flush(ChannelEndPoint.java:186)
    at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.flush(SslConnection.java:797)
    at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.fill(SslConnection.java:610)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:240)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.run(AbstractConnection.java:358)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:601)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:532)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: Connection reset by peer
    at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
    at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
    at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
    at sun.nio.ch.IOUtil.write(IOUtil.java:65)
    at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:492)
    at org.eclipse.jetty.io.ChannelEndPoint.flush(ChannelEndPoint.java:165)
    ... 7 more

You will need to set up SSL with a certificate trusted by Amazon. 您将需要使用Amazon信任的证书来设置SSL。 Read https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/developing-an-alexa-skill-as-a-web-service#requirements-for-your-web-service for requirements of your skill end point. 阅读https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/developing-an-alexa-skills-as-a-web-service#requirements-for-your-web-service对您的技能终点的要求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM