Transforming XML using https

P

PatrickRThomas

I have an XSL stylesheet that I need to transform with. The XSL
stylesheet is located at an HTTPS address. I've tried to transform my
XML using this stylesheet, but I keep getting a "no trusted certificate
found" error. This web site is supposed to be trusted, so I don't know
what I'm doing wrong. Please help! Here's a sample of my code:

//Transform the XML using XSL.
public void transform(String strXSLPath, Writer objWriter) throws
Exception{

//Add keystore even though this web site should already be trusted.
System.setProperty("javax.net.ssl.trustStore",
ConfigReader.GLOBAL_ROOT + "mywebsite.keystore");

//Get the stylesheet. (getWebHome() pulls the root URL from a
config file.)
URL objURL = new URL(SharedFunctions.getWebHome() + "/xsl/" +
strXSLPath);

//Create the StreamSource. This is when I get the error.
StreamSource objXSLSource = new StreamSource(objURL.openStream());

TransformerFactory objFactory = TransformerFactory.newInstance();
Transformer objTransformer =
objFactory.newTransformer(objXSLSource);

StreamResult objResult = new StreamResult(objWriter);

//Get the XML source from the Document that has already been
created.
DOMSource objXMLSource = new DOMSource(getDocument());

//Transform the XML and write the output to the stream.
objTransformer.transform(objXMLSource, objResult);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top