Use Java to remotely operate Domino server remotely through DIIOP

zhaozj2021-02-11  167

Recently played Domino, accumulating some experience, everyone to share: Developing Notes is the stone crossing the river, always encounters the problem, combined with Java more hard: (but notes has some advantages, such as full text search, security, development Time ... So still occupying a place in the group market. If you can call these functions through Java, it is also a waste use :) An example is sent, but gets the session, other operations and Notes scripting. . The operation example here is the environment of our company. Web users use IIS's combined NT authentication, because NT and Domino account synchronize, so there is no need to specifically log in to Domino. Send emails and use anonymous to send, in the Principal domain User, the received message is almost no difference in notes. Operation the Domino server requires an abstract class (providing connection operation) and the class Sendmail that implements logic operations. As follows: ============== ============================================================================================================================================================================================================= =================== File: Domino.java: ========================= ============================================================================================================================================================================================================= ======== Package steeven.lotus; import lotus.domino. *; import java.util. *; // Import Lotus.notes. *; // This class is an abstract class, other Java programs extend such That is. / * Environment: server: Domino5.01 NT4 client: Windows2000 Preparation: Open Notes Administrator Modify the server document, set the DIIOP service according to the Help. Note: Security:

Running a restricted Java / JavaScript: * Running unlimited Java / JavaScript: * Allows only the user access server in the address record: No (anonymous) Port: IIOP: Verification option: Name and password: Is anonymous: Yes 2. In the Domino Console: Load Diiop // Start Diiop Service Tell Diiop Quit // Turns Diiop Service 3. Connection, you don't have to use iOR, C: / Lotus / Domino / Data / Domino / HTML / DIIOP_IOR.TXT COPY full content, including "IOR:" s = notesfactory.createssionwithior (IOR, User, PWD); // User identity s = notesfactory.createsisWithior (IOR); // Anonymous 3. When anonymity Send Email It is recommended to use the "Principal" domain. When the mailbox will display your set value, the only trace is to read the letter When multiple Anonymous From domains are automatically born "anonymous", which is not changeable. 4. Debugging Note: NotSexception can not be CAST to exception otherwise do not get an error message try {// diiop cots here} catch (notesException e) {// can not be Cast System.Out.Println (E.GETCLASS (). Getname () ":" E.Text); E.PrintStackTrace ();} 5. Run environment, need nocr.jar, and you need to call DLL, file, set the environment variable PATH, increase C: / Lotus / NTOES, Win2000 prompt Can't find XXXX.dll, you can rename after nxxxx.dll copy.

* / Public abstract class Domino {private final String host = "dminoHost"; private final String user = "steeven"; private final String pwd = "password"; private final String IOR = "IOR: 010000002900000049444c3a6c6f7475732f646f6d696e6f2f636f7262612f494f626a6563745365727665723a312e3000000000010000000000000054000000010101000e0000003133332e3232312e3138382e3100acf6310000000438353235363531612d656336382d313036632d656565302d303037653264323233336235004c6f7475734e4f4901000100000000000000"; protected lotus.domino. Session s; public Domino () throws NotesException {createSession (); System.out.println ( "domino:" s.toString ());} private void createSession () throws NotesException {// s = NotesFactory.createSession (host User, PWD); // s = notesfactory.createssionwithior (IOR, USER, PWD); s = notesfactory.createssionwithior (iOR);}} ================== ============================================================================================================================================================================================================= =============== File: sendmail.java: ============================== == ==============================================

======== Package steeven.lotus; import lotus.domino. *; Import java.util. *; // Import Lotus.notes. *; public class sendmail extends Domino {java.util.arraylist grpusers = new java.util.ArrayList (); Database db; Document memo; RichTextItem rti; private Vector to = new Vector (); private boolean attachForm = false; static String mailFooter = "/ n / n / n this message sent by the http WebMail: //www/mail.jsp/n/n "; public sendmail () throws notesexception {system.out.println (" sendmail "); DB = S.GetDatabase (NULL," Webmail.nsf "); MEMO = DB. createDocument (); rti = memo.createRichTextItem ( "Body"); memo.setEncryptOnSend (true); memo.setSignOnSend (true); memo.sign (); memo.setSaveMessageOnSend (true);} public Sendmail (String to, String from, String subject, String body) throws NotesException {this (); setSendTo (to); setFrom (from); setSubject (subject); setBody (body); System.out.println ( "Sendmail with contructor");} public Sendmail (String to [] , String from, String subject, String body) throws NotesException {this (); setSendTo (to); setFrom (from); setSubject (subject); setBody (body); System.out.println ( "Sendmail with contructor"); } public void setSubject (String n) throws NotesException {memo.appendItemValue ( "Subject", n);} public void setFrom (String n) throws NotesException {memo.appendItemValue ( "Principal", n);} public void setSendTo (String N) throws notesException {.add (n); memo.appenditemvalue ("sendto", n);} public void setsendto (string n []) throws notesException {appendarray ("

Sendto ", N); for (int i = 0; i

转载请注明原文地址:https://www.9cbs.com/read-5847.html

New Post(0)