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);
}
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);
}