on 12-01-2009 2:45 PM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
User | Count |
---|---|
79 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.