+ Start a Discussion
Hetal ShethHetal Sheth 

Can any one help me in bypass Salesfoce SSL Validation?

We are using third party web service in salesforce but our third party instance has self-signed certificate. I need to call soap web service of third party.
But when I am trying to call web service at that time I am receiving  below error
System.CalloutException: IO Exception: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Please Provide me way to by pass this error.
RishavRishav
Hii Hetal,
This is not the salesforce problem.
You are doing something wrong in  putting the connection parameters of your third party web services. 
The error is telling that the certificate you are requesting through web service is not present on the given URL. 

Thanks
Rishav
Hetal ShethHetal Sheth

Hi Rishav,

Thanks for replay.
Please check my code and let me know what is the wrong in that.
-------------------------------
public class soapWebserviceForHomeKeepers {
    public static long soapWebserviceForAgencyData(){        
     serviceArmHudGov.ArmServiceImplPort innerobj=new serviceArmHudGov.ArmServiceImplPort();
        innerobj.inputHttpHeaders_x = new Map<String, String>();
        
        
        // innerobj.clientCertName_x ='ARM_Test';
        // innerobj.clientCert_x ='MFl6ajAwMDAwMDBFcldjITEhVWk5REdiYlZXamFtM1RrSmlzL2xPMitRUTJtN3NsejAyS1gxSXdab1l2ST0=';
        // innerobj.clientCertPasswd_x = 'admin123';    
       
        String username = '*****';
        String password = '******';
        Blob headerValue = Blob.valueOf(username + ':' + password);
        String authorizationHeader = 'Basic ' +EncodingUtil.base64Encode(headerValue);

        system.debug(authorizationHeader);
        
        innerobj.inputHttpHeaders_x.put('Authorization',authorizationHeader);
        
        innerobj.inputHttpHeaders_x.put('Cookie', 'name=value');
        serviceArmHudGov.submissionHeader5_0_element submissionHeader5_0_elementObj= new serviceArmHudGov.submissionHeader5_0_element();
        submissionHeader5_0_elementObj.agcHcsId='****';
        submissionHeader5_0_elementObj.agcName='HomeKeeper';
        submissionHeader5_0_elementObj.fiscalYearId='21';
        submissionHeader5_0_elementObj.cmsVendorId='***';
        submissionHeader5_0_elementObj.cmsPassword='*****';
        
         innerobj.endpoint_x='https://armpilot.hud.gov/ARM/ARM/';
       // innerobj.endpoint_x='https://arm.hud.gov/ARM/ARM/?wsdl';      
        long submissionId= innerobj.postAgencyData(submissionHeader5_0_elementObj,'TEXT/XML','http://island.zymr.com/rohit/testAgencyProfileData.xml');
        return submissionId;   
    }
    
}