【发布时间】:2014-06-20 04:25:57
【问题描述】:
我一直在通过https://developers.google.com/appengine/docs/java/endpoints/ 的教程学习 Google Endpoints。我将 Endpoint 成功部署到 Google App Engine,并设法构建了一个调用 Endpoint 的简单 iPhone 应用程序。但是,我的 iPhone 应用程序在尝试调用 Endpoint 时出现以下错误:
错误信息
错误 NSError * 域:@"com.google.GTLJSONRPCErrorDomain" - 代码:-32099 0x00000001094518a0
_userInfo __NSDictionaryI * 3 个键/值对 0x00000001094452b0
[0] (null) @"error" : @"java.lang.IndexOutOfBoundsException: Index: 0, Size: 0"
[1] (null) @"NSLocalizedFailureReason" : @"(java.lang.IndexOutOfBoundsException: Index: 0, Size: 0)"
[2] (null) @"GTLStructuredError" : (没有总结)
iPhone API 调用程序(在 Xcode 调试器中运行的 Objective-C 中)
- (IBAction)myButton:(id)sender {
NSInteger myId;
if (self.mySwitch.isOn) {
myId = 0;
}
else {
myId = 1;
}
GTLQueryHelloworld *query = [GTLQueryHelloworld queryForGreetingsGetGreetingWithIdentifier:myId];
[self.helloWorldService executeQuery:query completionHandler:^(GTLServiceTicket *ticket, id object, NSError *error) {
if (!error) {
[self.myLabel setText:object];
}
else {
[self.myLabel setText:[error description]]; // This line gets called
}
}];
}
我在Youtube video upload fails after 100 % progress for some users with Backend Error code:-32099 中发现了相同的错误消息,但它与调用 YouTube 有关,并且最终作为一个已修复的错误而关闭。所以我认为这没有关系。
我相信错误出在客户端,因为我在服务器 (Java) 上放置了一些日志记录,但它似乎没有被调用:
public class Greetings {
private static final Logger log = Logger.getLogger(Greetings.class.getName());
public static ArrayList<HelloGreeting> greetings = new ArrayList<HelloGreeting>();
static {
log.setLevel(Level.INFO);
greetings.add(new HelloGreeting("hello world!"));
greetings.add(new HelloGreeting("goodbye world!"));
}
public HelloGreeting getGreeting(@Named("id") Integer id) {
log.info("HelloGreeting called with getGreeting");
log.info("getGreeting id " + id);
return greetings.get(id);
}
我在 Google 服务器日志中没有看到“使用 getGreeting 调用 HelloGreeting”,我看到的只是指示我的 Endpoint 项目已成功部署的日志消息:
21:56:45.639 端点:https://1-war-dot-firstendpointproject.appspot.com/_ah/api/helloworld@v1 已保存
我还确认我可以从已部署的 API 资源管理器中为我的项目成功测试 helloworld.greetings.getGreeting API:
https://1-war-dot-firstendpointproject.appspot.com/_ah/api/explorer
当我从 Explorer 调用 API 时,它会生成一条日志消息:
24.130.150.54 - - [19/Jun/2014:21:17:45 -0700] "POST /_ah/spi/com.google.appengine.samples.helloendpoints.Greetings.getGreeting HTTP/1.1" 200 93 " https://1-war-dot-firstendpointproject.appspot.com/ah/api/static/proxy.html?jsh=m%3B%2F%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en.htta44JhPmg.O%2Fm%3D__features__%2Fam%3DAQ%2Frt%3Dj%2Fd%3D1%2Fz%3Dzcms%2Frs%3DAItRSTPk1CJ1YqUCyb-H-zhkQTjKPZwvbQ" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) 版本/7.0.3 Safari/537.75.14" "1-war-dot-firstendpointproject.appspot。 com" ms=17 cpu_ms=87 cpm_usd=0.000010 instance=00c61b117ce13f56d6eb483511c2c1bcd24241 app_engine_release=1.9.6
它不会生成“使用 getGreeting 调用的 HelloGreeting”,但我怀疑这是因为我没有配置记录器。无论如何,当我的客户调用端点时,我根本没有收到任何日志消息。由于 API 资源管理器调用至少生成 1 条日志消息,我怀疑问题出在客户端上。
问题:
1] 我看到的错误是在客户端还是服务器端生成的?
2] 你知道这个错误指的是什么数组吗?
3] 有哪些技术可用于调试此类连接问题?
感谢您对 StackOverflowers 的帮助!
迈克尔
【问题讨论】:
-
+1 因为我遇到了同样的问题(
Error Domain=com.google.GTLJSONRPCErrorDomain Code=-32099,当我从 Objective C 调用我的 Google Cloud Endpoints 服务时)并且希望看到答案...... -
我已经通过 Google Cloud 支持打开了支持票证。到目前为止,他们通过指出问题必须在端点的 Java 代码中提供帮助,因为详细的错误是 Java 异常 (java.lang.IndexOutOfBoundsException)。感谢您发布 Drux,我会让他们知道我不是唯一一个。
标签: java xcode google-app-engine google-cloud-endpoints google-cloud-platform