我正在尝试在 GAE 云中托管的 GAE 应用程序中调用 Google 服务:
private String doPost(String URL) throws ClientProtocolException, IOException {
// Params:
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("accountType", "HOSTED_OR_GOOGLE"));
params.add(new BasicNameValuePair("Email", _DEFAULT_USER));
params.add(new BasicNameValuePair("Passwd", _DEFAULT_PASS));
params.add(new BasicNameValuePair("service", "ah"));
// Call
HttpClient httpClient = new DefaultHttpClient();
HttpPost post = new HttpPost(URL); // URL:
// https://www.google.com/accounts/ClientLogin
post.setEntity(new UrlEncodedFormEntity(p_params, HTTP.UTF_8));
post.getParams().setBooleanParameter(
CoreProtocolPNames.USE_EXPECT_CONTINUE, false);
HttpResponse response = httpClient.execute(post);
return _ProcessResponse(response); // Process...
}
执行抛出: com.google.apphosting.api.ApiProxy$CallNotFoundException:未找到 API 包“remote_socket”或调用“Resolve()”
。
有什么想法吗?我完全迷失了...
最佳答案
您可以使用不同的 http 客户端吗?如推荐here :
client = new HttpClient(new SimpleHttpConnectionManager());
或者使用 URLFetchService 怎么样? ?
根据this blog post你需要一个:
"custom connection manager that converts the final requests and feed them into the URL Fetch service, and then feeds the responses back into HttpClient."
关于java - 未找到 API 包 'remote_socket' 或调用 'Resolve()' - GAE Java,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12710865/