TechTip: Ensuring the Connection When a Domino Java Agent Calls a Domino Servlet

Collaboration & Messaging
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times
Because of the design of our existing application, we found that we needed a Domino Java agent to make a call to a Domino servlet. We were able to accomplish this by making use of the URL and HttpURLConnection classes in the Java API to have our agent establish the connection to the servlet.

When we first implemented the Domino agent call to the Domino servlet, we encountered a problem. The Domino agent called the Domino servlet and made the connection, and all seemed fine. But we realized that the connection never totally completed. After we added a statement in the Domino agent to print out the response from the servlet, it worked correctly. This is the example code, with the bolded text being what we added:


URL url = new URL ("yourServletURL");
HttpURLConnection httpConn = (HttpURLConnection)url.openConnection();

// Opening the connection to URL
httpConn.setDoOutput(true); // Can read from the connection
httpConn.setRequestMethod("GET");
httpConn.connect();

System.out.println("Response: " + httpConn.getResponseCode() + " " + httpConn.getResponseMessage());

httpConn.disconnect();

Dan Boyum is a Software Engineer on the Business Solution Test team located at the Rochester, Minnesota, laboratory. He has 2.5 years of experience in the software testing field. His areas of expertise include Lotus Domino and Windows servers on iSeries. Dan can be reached at This email address is being protected from spambots. You need JavaScript enabled to view it..

Marilyn Dukart is an Advisory Software Engineer on the Business Solution Test team located at the Rochester, Minnesota, laboratory. She has over 15 years of experience in the software testing field. Her areas of expertise include Lotus Domino and WebSphere. Marilyn can be reached at This email address is being protected from spambots. You need JavaScript enabled to view it..

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$0.00 Raised:
$