问题
I've been using app engine for Java with cloud endpoints to create a REST api and have suddenly run into this error:
WARNING: No discovery doc for API hylytit version v1 in rpc format
I'm trying to load the Javascript client library into a web page to do a GET
call. In the web console, I see this:
GET http://localhost:8888/_ah/api/discovery/v1/apis/hylytit/v1/rpc?fields=methods%2F*%2Fid&pp=0 [HTTP/1.1 404 Not Found 5ms]
I'm unfamiliar with what RPC discovery docs are and can't find much online relating to App engine and RPC specifically. This is how I call the client library:
<script type="text/javascript">
function start() {
console.log("test.html onLoad function called.");
var ROOT = "http://localhost:8888/_ah/api";
gapi.client.load("hylytit", 'v1', function() {
var req = gapi.client.hylytit.listUrl();
req.execute(function(data) {
//Do something with the data.
});
}, ROOT);
}
</script>
<script type="text/javascript" src ="https://apis.google.com/js/client.js?onload=start">
</script>
It seems that the App Engine plugin for Eclipse isn't generating the right RPC discovery docs. Any idea how to fix this?
Edit: I have updated to the latest version of the Google Eclipse Plugin and the App Engine SDK as @Jenny suggested. I have also checked that all the cloud endpoint methods return valid types as @Ashish suggested, but continue to get the same error when I run it as a local server.
Interestingly, I have no issues when I deploy to app engine, only locally.
回答1:
Willma, did you update your App Engine Eclipse Plugin or SDK recently? If you did, try also update the Google Plugin for Eclipse. Those plugins need to be in-sync for Google Cloud Endpoint Client library generation to work properly on Eclipse. Once you update both plugins, the client library generation should work. Deploy the application to App Engine again, then you should be able to verify again based on the URL you showed above.
回答2:
Make sure you have valid return types. I was facing the same issue after using an invalid return type (boolean) for an ApiMethod. Note that GPE docs say, "In the Endpoint methods, the return value type cannot be simple type such as String or int. The return value needs to be a POJO, an array or a Collection."
https://developers.google.com/eclipse/docs/endpoints-addentities
来源:https://stackoverflow.com/questions/18190456/app-engine-rpc-discovery-doc