问题
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