简体   繁体   中英

WSO2 APi Manager Response Code 0

I'm trying to use WSO2 API Manager 1.10.0 on an existent micro-services project with REST APIs following WSO2 tutorial.

I have installed it on my computer as well as a copy of my application and configured AM to manage requests (GET, POST and DELETE) to my resource but I always obtain a "Response code 0" with Response Header

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

Trying to contact my application using Advanced REST Client I obtain 200 with the correct result.

My APIs use a token inside the header to authenticate the user passed so I have implemented a dummy API without authentication but I still have the same issue.

I have tried also the Cloud version with our test server but still obtaining the same result. I found this guide http://wso2.com/blogs/cloud/video-setting-up-custom-url-for-api-store-and-gateway/ but I don't know if this can be a solution for the problem in localhost.

Setting up the custom url in WSO2 API Cloud wont help. Thats there for a different purpose. There are two things you can do.

  1. If you are interested in going ahead with the cloud version, you can get help from them. You can send a support request and the cloud team will help.

  2. You can troubleshoot your local instance. When doing so, first, try to invoke your api via curl and see whether it gets a response. Sometime, your api can work fine, but due to some reasons, the result might not reach the api console.

If the curl works fine or not, you can check the logs to see whether there are any errors printed. Some more questions:

  1. Is your backend service exposed via http or https?
  2. If it is https, then if its certificate is not a CA signed one, API Manager will fail during the handshake. If so, you will have to add the cert to api managers client-truststore.jks
  3. In the cloud scenario, your backend should be accessible from internet and the certificate story is valid for cloud too.

Are you trying to access the api using swagger console (or any web application). There are couple of reasons you could encounter this issue. one could be certificate not installed in the browser.

If this happens you should see some error log in the api manager console (something related to CA not found). for that first you can copy the backend url (swagger console shows the url it used to send the request) and paste it on a new browser window and install the certificate to the browser.

also you can get an idea about the issue by using a tool like firebug and check the request. (it will show the error for not connecting the AM)

Finally I have found the issue: the API Manager does not accept plain text response, responding using a JSON solves the problem.

Using other mediatype such as XML or TEXT/HTML it reports 406, with text plain it returns Error 0.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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