【问题标题】:Android Restlet HTTPSAndroid Restlet HTTPS
【发布时间】:2011-08-29 10:12:33
【问题描述】:

当尝试使用此代码从我的网络服务(在应用程序引擎上运行)获取我的 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:// 工作的调用(移动是因为我需要 entityBuffering..)

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

【问题讨论】:

    标签: android https restlet


    【解决方案1】:

    搞定了。 将 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) - 调用线程在等待响应解除阻塞时超时。”

    【讨论】:

      【解决方案2】:

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

      【讨论】:

      • 您的意思是使用 ksoap2 作为 restlet 扩展?
      • 不是另一种使用网络服务的方式,你可以谷歌并找到关于 abt ksoap2 的信息
      • 有趣,但我的问题是关于restlet。
      猜你喜欢
      • 1970-01-01
      • 2012-03-30
      • 1970-01-01
      • 1970-01-01
      • 2013-01-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多