Email:   
Home
In This Issue
EasyPrint
Click here for the RSS feed's XML code. This is not a browser URL.
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. Click 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. Click 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.




[ Prev | Next ]

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
-- Advertisement --

2-Minute Tutorials
How do I...

  • integrate MS Office or OpenOffice with Notes?
  • create cross-tab reports and charts?
  • print serial letters and mailing labels?
  • create PDFs in Lotus Notes?


Check out the 2-minute tutorials here.
-- Advertisement --

DEPARTMENT CALENDAR - MANAGE AND SHARE A COMMON CALENDAR WITH YOUR TEAMS
Are you responsible for improving your organization's Group Calendaring tool? Have you been tasked to find a true group calendar tool with Itinerary, Time-Off, Sign In/Out and Bulletins/Events module that seamlessly integrates with Domino calendaring?

If so, Logic Springs Technologies will make answering these questions a whole lot easier!

Learn how by visiting us at www.departmentcalendar.com

Copyright © 1998-2008, ZATZ Publishing. All rights reserved worldwide.
Editor's Login