dominoExperts.com - Powered by Domino 8.5.2 Domino Accelerator Pack
- Accelerate your web applications
Lotus Triple Search DominoExperts + Blogs + R8 forum
dominoExperts.com -> Script vault -> Java

 Doing SSL from Domino using HTTPClient


Tomas NielsenPost date: 2007-10-10 19:23

 

For a customer we had a project that had to send SOAP messages over the internet so we had to look into HTTPS or SSL. Having done this back in the Java 1.1.8 (R5) days where you had to mess with the internals of Domino's JAR files I was a little worried.

But some googleing did show that some progress has been made(!). The Jakarta commons HTTP Client project comes to the rescue. http://jakarta.apache.org/httpcomponents/httpclient-3.x/index.html
It has been around for some time but that is usually a good thing. The latest stable version is 3.1.
It does all the things you could ask. Well it did not do proxying with the SOCKS protocol. But that is available in the 4 version - which is not stable yet.

Here is a very simple example just to show how simple it is to get started.
You need to put the files:
commons-codec-1.3.jar, commons-httpclient-3.1.jar, commons-logging-1.1.jar in your "\jvm\lib\ext" directory on your client and server.

Simple Agent example:
-------- cut here --------




import lotus.domino.AgentBase;
import lotus.domino.AgentContext;
import lotus.domino.Session;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.*;

public class JavaAgent extends AgentBase {
 public void NotesMain() {
  try {
   Session session = getSession();
   AgentContext agentContext = session.getAgentContext();
   HttpClient client = new HttpClient();
   GetMethod method = new GetMethod("https://www.verisign.com/");
   try {
    int status = client.executeMethod( method );
    System.out.println(status + "\n" + method.getResponseBodyAsString());
   } finally {
    // release any connection resources used by the method
    method.releaseConnection();
   }
                
  } catch(Exception e) {
   e.printStackTrace();
  }
 }
}
-------- stop cutting here --------



RSS feed
Subscribe to Forum

Share this page

Top posters
Tomas Nielsen212
Joacim Boive27
Fredrik Stöckel27
Danne14
Niklas Waller13
Kenneth Haggman11
Bryan Kuhn10
Daniel Lehtihet9
Jonas Israelsson8
dm997