【问题标题】:Android ASP web service with KSOAP2带有 KSOAP2 的 Android ASP Web 服务
【发布时间】:2011-10-24 06:47:00
【问题描述】:

我正在使用 KSOAP2 开发 Android。

我收到以下错误:

java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.

我的代码是:

SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);    
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
            SoapEnvelope.VER11);
    envelope.dotNet = true;
    envelope.setOutputSoapObject(Request);
    try {
        HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

        androidHttpTransport.call(SOAP_ACTION, envelope);

        SoapObject response = (SoapObject) envelope.getResponse();
        String result = response.getProperty(0).toString();
    textView1.setText(result);

    } catch (Exception e) {
    //textView1.setText(e.getMessage());

    }

【问题讨论】:

  • 提供完整的 logcat 输出。
  • java.security.cert.CertPathValidatorException:找不到证书路径的信任锚。

标签: android asp.net web-services ksoap2


【解决方案1】:

您使用的是 SSL (HTTPS) 连接,而您的服务器证书可能是自签名的(这就是您的手机无法验证信任链的原因。)

您最简单的解决方案是尝试不使用 HTTPS 并使其运行,然后获取真实的签名证书。

也有一些方法可以解决 Android 上的自签名 SSL 证书,但从您的问题来看,我认为最好不要花时间去研究它。

【讨论】:

  • 先尝试不使用 SSL 的代码,然后再考虑证书。 Google 是您的朋友。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-10-28
相关资源
最近更新 更多