【问题标题】:javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x52e57148:javax.net.ssl.SSLHandshakeException:javax.net.ssl.SSLProtocolException:SSL 握手中止:ssl=0x52e57148:
【发布时间】:2016-06-20 21:21:20
【问题描述】:

从服务器获取响应时,我收到如下错误:

javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL 握手中止: ssl=0x52e57148: SSL 库失败,通常是协议错误

我的代码是:

private static String NAMESPACE = "https://tempuri.org/";
private static String URL = "https://192.168.1.6:4800/WebServices/UserLogin.asmx";
private static String SOAP_ACTION = "https://tempuri.org/";

public static String invokeWS(String jsonObjSend, String webMethName) {
    String resTxt = null;

    // Create request
    SoapObject request = new SoapObject(NAMESPACE, webMethName);
    // Property which holds input parameters
    PropertyInfo jsonObj = new PropertyInfo();
    // Set Name
    jsonObj.setName("jsdata");
    // Set Value
    jsonObj.setValue(jsonObjSend.toString());
    // Set dataType
    // jsonObj.setType(JSONObject.class);
    jsonObj.setType(String.class);
    // Add the property to request object
    request.addProperty(jsonObj);

    // Create envelope
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
            SoapEnvelope.VER11);
    new MarshalBase64().register(envelope);
    envelope.dotNet = true;
    // Set output SOAP object
    envelope.setOutputSoapObject(request);
    // Create HTTP call object
    HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

    try {
        // Invole web service
        androidHttpTransport.call(SOAP_ACTION+webMethName, envelope);
        // Get the response

        SoapPrimitive  response = (SoapPrimitive ) envelope.getResponse();
        // Assign it to fahren static variable
        resTxt = response.toString();

        System.out.println("Response is: " + resTxt);

    } catch (Exception e) {
        e.printStackTrace();
        resTxt = "Null";
    }

    return resTxt;
}

【问题讨论】:

    标签: android web-services


    【解决方案1】:

    只是通过将 https 设置为 http,它就被重新使用了

    【讨论】:

    • 这是一种解决方法,但不是真正的答案。如果您找到了实际的解决方案,请添加它。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-07-07
    • 2016-04-02
    • 2016-10-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多