Android Restlet HTTPS

发布于 2024-11-08 18:32:17 字数 716 浏览 0 评论 0原文

当尝试使用此代码从我的网络服务(在应用程序引擎上运行)获取 Android 客户端上的一些数据时,

ClientResource cr = new ClientResource("https://myapp.appspot.com/restlet/service/");
IServiceResource res = cr.wrap(IServiceResource.class);
m_Services = res.getServices();

我收到此错误:

05-20 08:30:15.406: ERROR/AndroidRuntime(31767): Caused by: Communication Error (1001) - Could not change the mode after the initial handshake has begun.

我有 https 支持的 org.restlet.ext.ssl.jar 并且我正在使用此添加客户端的行,

Engine.getInstance().getRegisteredClients().add(new HttpsClientHelper(null));

这是自从我升级到 Restlet 2.1m4 以来我最接近的 https:// 调用工作(移动是因为我需要实体缓冲..)

有什么想法吗? 我还需要分享其他信息吗?

When trying to get some data on my android client from my webservice (running on app-engine) with this code

ClientResource cr = new ClientResource("https://myapp.appspot.com/restlet/service/");
IServiceResource res = cr.wrap(IServiceResource.class);
m_Services = res.getServices();

I get this error:

05-20 08:30:15.406: ERROR/AndroidRuntime(31767): Caused by: Communication Error (1001) - Could not change the mode after the initial handshake has begun.

i have the org.restlet.ext.ssl.jar for the https-support and i am using this line to add the client

Engine.getInstance().getRegisteredClients().add(new HttpsClientHelper(null));

this is the closest i have come to getting https:// calls to work since i moved up to restlet 2.1m4 (moved because i was in need of entityBuffering..)

Any ideas?
Any other information i need to share?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

贩梦商人 2024-11-15 18:32:17

成功了。
将 HttpClient 更改为 org.restlet.ext.net。

在Android上,你被告知这样做来改变客户端,

Engine.getInstance().getRegisteredClients().add(new HttpClientHelper(null));

但是这样做没有任何改变,相反,我成功地

Engine.getInstance().getRegisteredClients().clear();
Engine.getInstance().getRegisteredClients().add(new HttpClientHelper(null));

解决了这个问题(确保在你的构建路径中也有org.restlet.ext.ssl)。
这还解决了其他问题,例如“内部连接器错误 (1002) - 调用线程在等待响应以解锁它时超时”。

Got it working.
Changed HttpClient to org.restlet.ext.net.

On Android, you are told to do this to change the client

Engine.getInstance().getRegisteredClients().add(new HttpClientHelper(null));

However nothing changes by doing so, instead, i had success with

Engine.getInstance().getRegisteredClients().clear();
Engine.getInstance().getRegisteredClients().add(new HttpClientHelper(null));

This solves the issu(be sure to have org.restlet.ext.ssl in your build path aswell).
This also solves other issues such as the "Internal Connector Error (1002) - The calling thread timed out while waiting for a response to unblock it."

薄凉少年不暖心 2024-11-15 18:32:17

我曾使用 ksoap2 处理过 Web 服务,您可以通过下载 jar 并将其包含在您的项目中来尝试使用 ksoap2。

I had worked with web service using ksoap2, u can try using ksoap2 by downloading the jar and including in ur project.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文