I have been working on this all day, and am just guessing as to what to do. It seems as though people that know how this functionality works assumes that everyone else knows what they are talking about. They will say things like use utility ABC to generate DEF, but assume that you know what ABC is, how to use it, and what to do with DEF after it's done. Let me pre-face by saying I'm an AS400 RPG coder at heart, but can do a few things in Java. Enough to be dangerous I guess. I still don't quite understand what a trust store, or key store even is technically.
Basically, I have developed a simple AS400 java application, which basically just calls some HTTP methods to send a transaction to an external party. This application is called directly from an RPGLE program. This has been working fine, but now they have decided to use HTTPS. The client has sent me a .PFX file that contains some stuff in it from when they created the key using a utility called digital certificate manager on the AS400. I have found enough information to gather that I have to have an SSL properties file in my root application directory in IFS, and the job is looking at that properties file and it seems to have the correct parameters. What I am having a hard time with, is how you can have the certificate trust the application. I'm not sure if you need the .PFX file to exist in your IFS root directory of the application, or if you have to create a trust store/key store, or if you need anything at all besides the SSL properties file? I have found answers of yes to all questions, depending on who you ask. Some answers lead you down the path of doing exhaustive things to get to a certain point, only to have nothing happen. This is more of a vent than anything. I have almost come to the conclusion that this stuff is impossible. :)
For what it's worth, below is the code I'm using for connecting to the service using just HTTP. I have been looking for a simple step by step process to explain what is required for HTTPS handshakes to occur successfully on the AS400. I don't have enough information to know whether I need to get more from the client, or if I have enough to make it work on my own.
HttpClient m_HttpClient = null;
PostMethod m_PostMthd = null;
SimpleHttpConnectionManager m_simpleHttpConMnger = new
SimpleHttpConnectionManager();
int timeoutInMilliseconds = 10000;
m_PostMthd = new PostMethod(urlEndpoint);
m_HttpClient = new HttpClient(m_simpleHttpConMnger);
HttpConnectionManagerParams lhttpConMnger =
m_simpleHttpConMnger.getParams();
lhttpConMnger.setConnectionTimeout(timeoutInMilliseconds);
lhttpConMnger.setSoTimeout(timeoutInMilliseconds);
m_PostMthd.setRequestHeader("SOAPAction",SOAPAction);
m_PostMthd.setRequestHeader("Content-Type","text/xml; charset=UTF-8");
m_PostMthd.setRequestEntity(new StringRequestEntity(inputMsg));
int l_status = m_HttpClient.executeMethod(m_PostMthd);
System.out.println("EXECUTION STATUS : " + l_status+"\n");
InputStream is = m_PostMthd.getResponseBodyAsStream();
BufferedReader rd = new BufferedReader(new InputStreamReader(is));
String line;
StringBuilder response = new StringBuilder();
while ((line = rd.readLine()) != null)
{
response.append(line);
response.append('\r');
}
rd.close();
return response.toString();