developers

    Forum Stats

  • 3,873,861 Users
  • 2,266,623 Discussions
  • 7,911,645 Comments

Discussions

Allowing through SSl/TLS 2.0 Authentication OATS Automation

rams.prsk
rams.prsk Member Posts: 1
edited Jun 25, 2018 2:39PM in QA/Testing

Hi All,

As per the telecon discussion that we had now, Please find the code below where i was trying to pass JSON input to the REst Assured API using PUT method and while iam trying to pass through TLS

authentication using OATS(Oracle APplication testing Suite) iam getting Hand Shake failure error. And the Java version iam using is Java 1.8

RequestSpecification request = RestAssured.given();

JSONObject requestParams = new JSONObject();

String AsnNumber= (String) map.get("ASNNumber");

String vendorName= (String) map.get("vendorName");

String rollUp= (String) map.get("rollUp");

String compressedDelivery = (String) map.get("compressedDelivery");

String regionCode= (String) map.get("regionCode");

String dataSource = (String) map.get("dataSource");

requestParams.put("AsnNumber", AsnNumber);

requestParams.put("vendorName", vendorName);

requestParams.put("rollUp", rollUp);

requestParams.put("compressedDelivery", compressedDelivery);

requestParams.put("regionCode", regionCode);

requestParams.put("dataSource", dataSource);

System.out.println(requestParams.toJSONString());

request.header("Content-Type", "application/json");

        request.body(requestParams.toJSONString());

        System.setProperty("https.protocols", "TLSv1.2");

        //System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2");

        //System.setProperty("https.cipherSuites","TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256");

//        Response response = request.put("/ComplianceService");

        URL url = new URL("https://complianceservice-ge4.cfapps.pcf1.vc1.pcf.dell.com/api/ComplianceService");

        System.out.println(url);

        //Response response = request.put("https://complianceservice-ge4.cfapps.pcf1.vc1.pcf.dell.com/api/ComplianceService");

        //URL url = new URL("https://complianceservice-ge4.cfapps.pcf1.vc1.pcf.dell.com/api/ComplianceService");

        SSLContext ssl = SSLContext.getInstance("TLSv1.2");

        ssl.init(null, null, new SecureRandom());

        HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();

        connection.setSSLSocketFactory(ssl.getSocketFactory());

        System.out.println("Before Response");

        Response response = request.put("https://complianceservice-ge4.cfapps.pcf1.vc1.pcf.dell.com/api/ComplianceService");

        System.out.println("After Response");

        int statusCode = response.getStatusCode();

 

Thanks,

Ram

This discussion has been closed.
developers