简体   繁体   English

带有KSOAP2的Android ASP Web服务

[英]Android ASP web service with KSOAP2

I'm developing Android with KSOAP2. 我正在使用KSOAP2开发Android。

I get the following error: 我收到以下错误:

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

My code is: 我的代码是:

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());

    }

You're using an SSL (HTTPS) connection, and your server's certificate is probably self-signed (which is why your phone can't validate the trust chain.) 您正在使用SSL(HTTPS)连接,并且服务器的证书可能是自签名的(这就是您的电话无法验证信任链的原因。)

Your easiest solution is to try without HTTPS and get it running, then get a real, signed cert. 最简单的解决方案是尝试不使用HTTPS并使其运行,然后获取真实的,经过签名的证书。

There are ways to work around self-signed SSL certs on Android, too, but judging from your question I think that the time is better spent not delving into that. 也有多种方法可以解决Android上自签名SSL证书的问题,但是从您的问题来看,我认为最好不要花时间去研究它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM