Skip to Content
0
Former Member
Mar 10, 2009 at 04:34 PM

Par Component: Connexion to https url

13 Views

Hi,

We try to connect an HTTPS URL via a PAR Component in order to retrieve the associated output stream.

For this, we try to use the Secure Connexion Factory as explained

- By SAP in the following link: http://help.sap.com/saphelp_nw04s/helpdata/en/e2/71c83edf72e16be10000000a114084/frameset.htm|http://help.sap.com/saphelp_nw04s/helpdata/en/e2/71c83edf72e16be10000000a114084/frameset.htm]

- Existing forum topic: [https-connection-from-portal-to-external-webserver|https-connection-from-portal-to-external-webserver]

In our implementation, we have:

- Put the certificate of the HTTP site into the Key Storage of the Visual Admin

- Implement the following code into the PAR Component:

InitialContext ctx = new InitialContext();

Object o = ctx.lookup("keystore");

KeystoreManagerWrapper_Stub manager = (KeystoreManagerWrapper_Stub) o;

KeyStore keystoreCAs = manager.getKeystore("TrustedCAs");

SecureConnectionFactory factory = new SecureConnectionFactory(keystoreCAs, null);

+LOCATION.debugT("KeyStore : " + keystoreCAs.toString());+

java.security.cert.Certificate cert = keystoreCAs.getCertificate("XXXXX");

+LOCATION.debugT("Cert : " + cert.toString());+

httpConn = factory.createURLConnection(_url);

httpsConn.addRequestProperty("proxySet", "true");

httpsConn.addRequestProperty("https.proxyHost", "XXXXX");

httpsConn.addRequestProperty("https.proxyPort", "XXXXX");

httpsConn.setAllowUserInteraction(true);

httpsConn.setDoInput(true);

httpsConn.setDoOutput(true);

httpsConn.setDefaultAllowUserInteraction(true);

byte[] bhtml = Utils.loadAsBytes(httpsConn.getInputStream());

Where XXXXX are our own data properties

The result is the following:

- We retrieve the good certificate

- But we have a "Connection Time-out" error when trying to retrieve the input stream of the connexion:

byte[] bhtml = Utils.loadAsBytes(httpsConn.getInputStream());

For information, we are in NWDS 7.00 SP14.

Thanks in advance for any help.

Best Regards,

Fabien