WSO2 API 管理器 - 示例 PizzaShackAPI 不起作用 [英] WSO2 API Manager - Sample PizzaShackAPI is not working

查看:25
本文介绍了WSO2 API 管理器 - 示例 PizzaShackAPI 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 WSO2 API 管理器的新手.我按照快速入门指南通过部署示例 PizzaShackAPI 来学习.

I am new to WSO2 API Manager. I followed the Quick Start Guide to learn by deploying sample PizzaShackAPI.

https://docs.wso2.com/display/AM210/Quick+Start+Guide

当我点击试试看!"时,我没有得到指南中提到的正确响应.

As I click "Try It Out!", I am not getting the correct response as mentioned in the guide.

我收到以下响应,并且最初没有登录控制台.

I am getting the below response and there is no log in the console initially.

响应代码

0

响应头

{
错误":服务器无响应"}

{
"error": "no response from server" }

在 Firefox 中添加自签名证书作为添加异常后,我在控制台中收到以下错误,

After I added Self Signed Certificate in Firefox as Add Exception, I am getting the below error in the console,

[2017-03-01 15:06:51,309] ERROR - SourceHandler I/O error: An established connection was aborted by the software in your
 host machine
java.io.IOException: An established connection was aborted by the software in your host machine
        at sun.nio.ch.SocketDispatcher.read0(Native Method)
        at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
        at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
        at sun.nio.ch.IOUtil.read(IOUtil.java:197)
        at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
        at org.apache.http.nio.reactor.ssl.SSLIOSession.receiveEncryptedData(SSLIOSession.java:371)

我猜可能是证书配​​置问题.请帮我解决这个问题.

I guess it may be a certificate configuration issue. Please help me to resolve this issue.

我尝试创建自己的 API.面临同样的问题.

I tried with creating my own API. Facing the same issue.

推荐答案

API 控制台上的错误消息error": no response from server" 主要是由于 CORS 错误.您能否检查您的浏览器控制台并查看那里的错误,您很可能会看到与 cors 相关的错误.

Error message "error": "no response from server" on API console is mostly due to CORS error. Could you please check your browser console and see the error there, Most likely you will see error related to cors.

注意:这些更改不建议用于生产环境,对于生产环境,您希望提供所有相关信息而不是允许所有 (*)

Note: these changes are not advised for production environment, for production environment you want to provide all relevant information instead of allow all (*)

要允许所有标题和源编辑 repository/conf/api-manager.xml 并更改以下值:

To allow all headers and origin edit repository/conf/api-manager.xml and change values for following:

<Access-Control-Allow-Headers>*</Access-Control-Allow-Headers>
<Access-Control-Allow-Origin>*</Access-Control-Allow-Origin>

第二次更改以允许所有主机名并避免任何证书主机名验证.编辑 /repository/conf/axis2/axis2.xml 并取消注释 HostnameVerifier 并将值更改为 AllowAll.

Second change to allow all host name and avoid any certificate host name validation. Edit /repository/conf/axis2/axis2.xml and un comment HostnameVerifier and change value to AllowAll.

<parameter name="HostnameVerifier">AllowAll</parameter>

重新启动 API Manager 并再次测试.

Restart API Manager and test again.

这篇关于WSO2 API 管理器 - 示例 PizzaShackAPI 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆