WSO2 API Manager “error”: “no response from server”

笑着哭i 提交于 2019-12-11 01:13:53

问题


I have published API in WSO2 using swagger JSON. After publish I am trying to call rest api using swagger in APP Console. It says

Response Body no content

Response Code 0

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

There is no any error on server which will help me to understand problem.

Here is the request URL which I am using in local server : https://192.168.1.118:8243/api/2.0/questions/1/answers?start=1&end=1&fields=answerId%2CanswerDescription%2CcreateDate


回答1:


In my API there are some custom header parameter. Because of this custom header parameter it was not working. I have added custom header parameter in api-manager.xml file.

<Access-Control-Allow-Headers>authorization,Access-Control-Allow-Origin,Content-Type,loggedInUserId,accessToken,clientToken</Access-Control-Allow-Headers>



回答2:


I have faced a similar issue. I have edited the URL(from apicreator login) after it was published for first time and published it again. But the changes were never reflected. WSO2 was pointing to the old URL. Check the logs for error at "WSO2 HOME\repository\logs\wso2-apigw-errors" . Create another version and publish again and it should work.




回答3:


The error is real, but misleading. In most likelihood, you've set the spec so that it returns a specific content type (say, application/json) but you actually return plain text (like a string or a number). swagger-ui expects it to be a JSON, tries to parse it and fails, giving you the wrong error message. However, it does mean your spec does not match what your API actually does.



来源:https://stackoverflow.com/questions/37272302/wso2-api-manager-error-no-response-from-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!