Data interaction with Lotus and heterogeneous systems with .NET
We use the development platform:
Server: Windows2000 Web Server: IIS5.0 Lotus Notes / Domino 5.0.3;
XML Web Service Service Development Tools: Visual Studio.net Beta2;
Client: ASP web page or VB Windows Application.
Development steps:
1) Notes database for Lotus Notes / Domino
Create a new Notes database or use the original database. There is at least one form in this database, there are some domains in the form, used to store some entries. Build a few views, the view is mainly used to display documents in accordance with certain rules. For example, in order of time or in accordance with the click rate of the document.
2) Establish an XML Web Service service
Open the Visual Studio .NET Beta2, new project -> Visual C # ASP.NET web service, delete the default ASMX file, create a new web service page newspublicish.asmx, open the newspublish.asmx.cs file, here will be we write Source code place. Right click on the solution, add a reference, select the Lotus Domino Object component in the COM component, and then reference the COM component, you can access the Notes database in our program. Ok, you can start writing code providing methods to call service. Here, the author gives one of the methods, GetNewbyPostTime provides services for obtaining the specified number of news entries, and each news entry is only the basic information such as submission time, title, classification, document identification number, and the like, without specific content. The following is a partial source code.
GetnewsByPostTime method:
/ / Return to the news entry and store it in an array
// Pagesize parameter number of news entries
Public newsitem [] getnewsbyposttime (int pageize)
{
Domino.iviewnavigator vn;
Domino.IVIEWENTRY H;
Domino.idocument doc;
INT INDEX = 0;
Newsitem [] result = new newsitem [pagesize];
/ / Connect Notes database
Vn = connecttonotesdb ("", "bbs.nsf", "bufy_2001", "all documents", OUT H);
// Get information about each news document
DO
{
Doc = H. Document;
Result [index] = new newsitem ();
Result [index] .subject = doc.getfirstITEM ("Subject"). Text;
Result [index] .category = doc.getfirstIrym ("categories").
Result [index] .posttime = doc.created.toString ();
Result [index] .author = doc.getfirstIr = Doc.GetFirstIrt ("from").
Result [index] .newsid = doc.noteid .tostring ();
INDEX ;
h = vn.getnextdocument (h);
}
While (h! = null && index } Method for connecting the LOUTS database: / / This method establishes a NOTES database connection and get the handle of the view. Public Domino.iviewNavigator Connecttonotesdb (String Pserver, String PdbfileName, String PPassword, String PnotsView, Out Domino.IVIEWENTRY H) { Notessession S = New NotesSession (); Domino.idatabase db; Domino.IVIEW V; Domino.iviewnavigator vn; S.Initialize (PPASSWORD); DB = S.GetDatabase (PServer, PDBFileName, False); v = db.getView (pNOTESVIEW); Vn = v.createViewNAV (0); : H = vn.getfirstdocument (); Return VN; } He has completed the definition of the Web Service service, and the [WebMethod] is marked on the Web Service service you want to publish so that the service can be accessed by the client. 3) Construction of the client The client can have many ways to build, only the connection method of the ASP Web site is described here. The client wants to get the XML Web Service service, in addition to supporting the connection of HTTP, you must be able to parse the XML document. ASP accepts XML messages by calling an XMLHTTP component, and analyzes the XML document to obtain the information we need. Here, the author only lists the ASP request, accepts the source code of the XML service and parsing the XML document: DIM OXMLHTTP Dim Odom Set oxmlhttp = server.createObject ("Microsoft.xmlhttp") Set odom = server.createObject ("Microsoft.xmldom") 'Request for XML Web Service service using the POST method Oxmlhttp.open_ "post", "http://192.168.3.11/dominoxmlwebservice/newspublish.asmx/getnewsdetails", f_alse 'Using the GET method to complete the request for XML Web Service service 'oxmlhttp.open_ "get", "http://192.168.3.11/dominoxmlwebservice/newspublish.asmx/getnewsbycount?_ Newsid = "& newsid &", false 'Set POST method parameters OXMLHTTP.SetRequestHeader_ "Content-Type", "Application / X-WWW-FORM-URLENCODED" 'Send POST data Oxmlhttp.send "newsid =" & newsid & "" 'If you use a get method, the send method is as follows. 'oxmlhttp.send Set = oxmlhttp.responsexml Set death = odom.documentelement.childNodes (0) Newsid = Thenode.childNodes (0) .TextSubject = Thenode.childNodes (1) .text Category = Thenode.childNodes (2) .text Count = Thenode.childNodes (3) .text Posttime = Thenode.childNodes (4) .text Author = Thenode.childNodes (5) .text Body = Thenode.childNodes (6) .text At this point, we have completed all tasks.