小编典典

找不到API包“ remote_socket”或调用“ Resolve()”-GAE Java

java

我正在尝试在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: The API package 'remote_socket' or call 'Resolve()' was not found

有任何想法吗?我完全迷路了…


阅读 226

收藏
2020-11-30

共1个答案

小编典典

您可以使用其他http客户端吗?如推荐这里

client = new HttpClient(new SimpleHttpConnectionManager());

还是使用URLFetchService呢?

根据此博客文章,您需要:

“定制连接管理器,它将最终请求转换为URL提取服务,然后将响应反馈回HttpClient。”

2020-11-30