0

I am using a Post request of restAssuredApi having body in XML format.

RestAssured.baseURI = basetUrl;
        RequestSpecification request = RestAssured.given();
        response = request.headers(headers()).body(getXMLasString(XmlPath))
                .queryParam("key", "value").post(endPoint);

Here getXMLasString is a method that converts XML to string and XmlPath is the path of the XML file

I am getting this error. Can someone help me to disable or bypass this SSL certificate issue?


javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
    at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1946)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:316)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:310)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1639)
    at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:223)
    at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1037)
    at sun.security.ssl.Handshaker.process_record(Handshaker.java:965)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1064)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1367)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1395)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1379)
    at org.apache.http.conn.ssl.SSLSocketFactory.createLayeredSocket(SSLSocketFactory.java:570)
    at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:554)
  • 1
    Not sure, but [this](https://stackoverflow.com/questions/36352033/how-to-make-https-get-call-with-certificate-in-rest-assured-java) might work, depending on which version you are using. (the first answer regarding using ```relaxedHTTPSValidation```) – Gryphon Sep 02 '20 at 06:41
  • 1
    `given().relaxedHTTPSValidation()...` – Fenio Sep 02 '20 at 06:53

0 Answers0