|
|
|
|
|
|
|
|
|
|
|
|
|
|
How to create a Web service to extract data from XML documents (continued)
Exporting Lotus Notes data to an XML file using LotusScript This article describes how to create and implement a Web service that extracts and manipulates data from an XML document. To demonstrate XML's ease of use and portability, the sample Web service accesses and processes data from an XML document created by a Lotus Notes database application using LotusScript. Although any programming language with the ability to create and manipulate text files could be used to illustrate creating a simple XML document, LotusScript was chosen for this example. ASP.NET is then used to create the sample Web service that processes the Lotus Notes data and publishes the results to the Web.
Exporting Lotus Notes data to an XML file using LotusScript The LotusScript in Figure A needs to be copied to a procedure in a Lotus Notes database-form or agent in order to produce the required XML document.
FIGURE A
 
Copy this LotusScript to a procedure in a Lotus Notes database-form or agent. Roll over picture for a larger image.
The only change necessary to the code is the parameter "YourNotesServer" in the notesSession.GetDatabase method call. Change this parameter to the name of your Notes Server. Once you run this code, it will produce an XML document called names.xml located in c:\temp. You can change this path if necessary by modifying the code. The document will contain selected contact information from the Lotus Notes names.nsf database. In the code fragment above, you'll see that it steps through the records of the names.nsf database and adds the FirstName, LastName, Company, Department, and Email field values to the newly created names.xml document. This process uses simple LotusScript file I/O functionality to create the XML document as it builds an XML database table, as we see in Figure B.
FIGURE B
 
The names.xml document is shown in Internet Explorer. Roll over picture for a larger image.
Figure B displays the names.xml document in Internet Explorer. It's made up of a data level called an "Element" which we refer to as "People". This parent-element has five child-elements, called FirstName, LastName, Department, Company, and Email. These five elements have a sibling-to-sibling relationship. Here NotesData is the root element. XML documents can have only one root element, and branches must be closed before another opens, so, </FirstName> must close before <LastName> opens, etc. A well-structured XML document has been created through a simple file manipulation procedure using LotusScript. Now let's create the Web service.
Creating the ASP.NET Web Service Enter Visual Studio.Net's IDE and go to the New Project Dialog Box by selecting New->Project from the File menu. Once in the dialog box, the Visual Basic Project folder and the ASP.NET Web Service icon should be highlighted, and the Location field should contain the path http://localhost/NotesData. By pressing the Okay button, a new Web service named NotesData will be created. This process will also create a virtual directory in the IIS and generate sample code. The generated code is shown in Figure C.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Advertisement --
Sophisticated Meets Simple For Document Management
Share. Control. Manage.
Documents, emails, and content in the context of how work is done.
Native to Lotus Domino. The User Experience unseen for Lotus Domino.
Do more with less. Really.
See the possibilities Docova unleashes for Lotus Domino. |
-- Advertisement --
Teamstudio Edition 25 has shipped
It's finally here! Now that Teamstudio Edition 25 has shipped, listen to our latest Tool Time audio program to find out what's changed. Updates to all your favorite Teamstudio tools will be discussed.
Plus, you'll get an introduction to Teamstudio Undo (formerly known as Teamstudio Snapper).
Tap here to get started! |
|
|
|
|
|
|
|
|
|
|