cancel
Showing results for 
Search instead for 
Did you mean: 

SSL or not

Former Member
0 Kudos

Hi All,

I have a requirement in our migration from the existing middleware to PI 7.1 where we need to hit an URL using SSL. The client had given few Certificates which are imported into the KeyStore of NWA (neither in the DEFAULT nor in the TrustedCAs). We are trying to make a https call from the java code of the mapping as we need the response whether it is successful or not (200 or not) where in either case something needs to be done. We need to go through a Proxy for any communication out of our landscape. When we execute the java code, we are getting the below error.

Proxy Connection error: java.net.ConnectException: Connection refused: connect

try

{

getTrace().addWarning(" Before the creation of the Socket ");

Socket socket = socketFactory.createSocket(myProxyHost, myProxyPort);

getTrace().addWarning(" After the creation of the Socket ");

// URL url = new URL(myTargetURL);

getTrace().addWarning(" After the creation of the URL ");

URLConnection urlConnection = url.openConnection();

getTrace().addWarning(" After the creation of the urlConnection ");

urlConnection.getInputStream();

BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream(),"US-ASCII"));

getTrace().addWarning("getting response");

String line = "";

while((line = reader.readLine()) != null)

getTrace().addWarning(line);

OutputStream outputstream = socket.getOutputStream();

OutputStreamWriter outputstreamwriter = new OutputStreamWriter(outputstream);

BufferedWriter bufferedwriter = new BufferedWriter(outputstreamwriter);

String string = null;

// while ((string = bufferedreader.readLine()) != null)

// {

// bufferedwriter.write(string + '\n');

// bufferedwriter.flush();

// }

getTrace().addWarning(" After the creation of the Socket ");

}

catch (Exception e)

{

getTrace().addWarning(" In the Catch Block : "+e.getMessage());

}

With the same certificates, the existing middleware is able to connect to the target URL.

I doubt whether the SSL is enabled on PI.

Can any one please help me in this regard.

Thanks in Advance.

Anil

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member568822
Active Participant
0 Kudos

Hi,

Do you enable you PI server for the SSL? Kindly follow the guide if you havent do it

http://help.sap.com/saphelp_nw04s/helpdata/en/3a/7cddde33ff05cae10000000a128c20/frameset.htm.

You have to install the SAP Cryptographic Library in order to use SSL function.

Thanks.

Former Member
0 Kudos

I'm not familiar with JAVA SSL socket handling, but I do not see any references to security aspects in your code ? Should you not call the corresponding keystore, client certs, etc ...

I remember seeing things using javax.net.ssl.* classes ...

Rgds

Chris

PS : why using native socket operations within XI/PI code (mapping) ?

Edited by: Christophe PFERTZEL on Dec 1, 2009 3:52 PM

Former Member
0 Kudos

Hi,

Where can I find the sample code using the SAP Classes for the same.

Anil

ravi_raman2
Active Contributor
0 Kudos

it does not need to be sap standard classes as its not an advocated best practice approach.

You can use standard java api`s to make the call.

Regards

Ravi Raman

Former Member
0 Kudos

You can find details about Secure Connection Factory (and samples) here :

http://help.sap.com/saphelp_nw70/helpdata/en/8b/67cefde92b984eafadfc0ec02e24ed/content.htm

Maybe it could help you ... For more "generic" code samples (using SUN JDK classes), just google for JAVA + SSL + code + client(or server)

Rgds

Chris