Hi,
I am trying to upload an xml to a web service to be validated. I have read the Servoy documentation for the http plugin but it always gives me the same error when execute the request.
“PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target”
I think it is a problem with the digital certificate that I want to use for sending. I have imported the digital certificate that I want to use for sending to the Java Keystore cacerts but it keeps giving me the same error.
This is the code that I have generated in Servoy and I would appreciate any help or explanation of why it gives me this error and how to solve it so that I can upload the xml to the web service correctly. Thanks.
function envioTBAI(myXml){
//myXml = path where I have the xml. Example "c:\tmp\TBAI2209713_firma.xml"
var url = "https://tbai-z.prep.gipuzkoa.eus/sarrerak/alta";
var client = plugins.http.createNewHttpClient(); // Creating new http client
var poster = client.createPostRequest(url);
poster.addHeader("Content-Type", "application/xml");
poster.addHeader('Accept', 'application/xml');
poster.setCharset('UTF-8');
poster.addFile(null,'XMLTBAI',myXml,'text/xml');
var response = poster.executeRequest()
var pageData = response.getResponseBody();
//Get Status Code. 200 is OK
application.output("Response status code: " + response.getStatusCode());
application.output("Response reason: " + response.getStatusReasonPhrase());
application.output("Response body: " + response.getResponseBody());
application.output("Response exception msg: " + response.getException());
response.close();
client.close();
return pageData
}