Google Cloud Endpoints EOFException

JR *_*lia 5 java google-app-engine android gzip google-cloud-endpoints

我在AppEngine中有以下方法:

@ApiMethod(name = "authed", path = "greeting/authed")
public HelloGreeting authedGreeting(User user) {
    ...
}
Run Code Online (Sandbox Code Playgroud)

我在Android AsyncTask中的doInBackground方法:

HelloGreeting hg = null;
try {
    hg = service.authed().execute();
} catch (IOException e) {
    Log.d("error", e.getMessage(), e);
}
return hg;
Run Code Online (Sandbox Code Playgroud)

我遇到了ff错误:

/_ah/api/.../v1/greeting/authed: java.io.EOFException
Run Code Online (Sandbox Code Playgroud)

在logcat中:

Problem accessing /_ah/api/.../v1/greeting/authed. Reason: INTERNAL_SERVER_ERROR
    at java.util.zip.GZIPInputStream.readUByte
    at java.util.zip.GZIPInputStream.readUShort
    at java.util.zip.GZIPInputStream.readUShort
Run Code Online (Sandbox Code Playgroud)

它只在调用非auth方法时有效.怎么解决?

我使用本地服务器.

Ale*_*ggs 7

我在调用插入值时遇到了类似的问题.我有点不同,因为我没有使用身份验证,但是我得到了同样的例外.我正在使用appengine-java-sdk-1.8.8.我能够使其他端点调用出现此错误.我查看了生成的代码,我看到的工作调用与非工作调用之间的差异是HttpMethod.失败的电话被定义为"POST".我能够使用注释httpMethod=ApiMethod.HttpMethod.GET中的@ApiMethod注释属性来更改它.

@ApiMethod(httpMethod = ApiMethod.HttpMethod.GET, name = "insertUserArtist", path = "insertUserArtist")
Run Code Online (Sandbox Code Playgroud)

然后,我重新生成了客户端代码,我能够在没有得到可怕的情况下进行调用EOFException.我不确定为什么POST不能正常工作但将其更改为GET工作.这可能会提出一些关于可以发送多少数据并且应该解决的问题(可能是库问题).我将研究创建一个提交给Google的演示应用程序.

  • 任何人都知道为什么这有用吗? (3认同)