0
votes

When getting the response from the server I am getting an error like this:

javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x52e57148: Failure in SSL library, usually a protocol error

My code is:

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;
}
1

1 Answers

-6
votes

Just By making https to http it got resloved