Transforming XML using https

Discussion in 'Java' started by PatrickRThomas@hotmail.com, Jun 2, 2005.

  1. Guest

    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);
    }
    , Jun 2, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dwhitford
    Replies:
    0
    Views:
    360
    dwhitford
    May 14, 2004
  2. Krista Lemieux

    Transforming XML with XSL to String

    Krista Lemieux, Aug 10, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    456
    Steve Flitcroft
    Aug 10, 2004
  3. Ken Adams
    Replies:
    1
    Views:
    695
    Arnaud Berger
    Mar 10, 2005
  4. Xamalaek
    Replies:
    0
    Views:
    379
    Xamalaek
    May 14, 2004
  5. Xamalaek
    Replies:
    1
    Views:
    444
    Patrick TJ McPhee
    May 19, 2004
Loading...

Share This Page