|
The purpose of this series/demonstration is
to show you how a single java agent can receive
xml and using those xml instructions create
Lotus Notes documents in any database on that
server (ACL permitting).
This series therefore will show you:
- Constructing an XML Document using JavaScript
to send to Domino
- Building a Domino Java Agent
- XML receiving/parsing using a Domino Java
Agent
- Creating a Notes Document from a Java Agent
- Demonstrate how to create Notes Documents
from remote/3rd Party applications
The Download Files
You can download
the files to go with this series here. Within
the download zip file you will find the following
files:
- Contacts.nsf - Data Store for Project
- XMLReceive.nsf - The main application database
- contact_form.htm - Used for outside of Domino
Demo
- javascript.js - Used for outside of Domino
Demo
There is only one change you need to make to
the files> if you open the standalone "javascript.js"
file - locate the following code:
function requestForm(){
XMLPOST.location.href="http://127.0.0.1/XMLReceive.nsf/postxml.htm?openform"
}
Change the URL to the name of your domino server
- and if you are not going to put the XMLReceive.nsf
database in the root folder within domino/data
then also add the folders in front of the 'XMLReceive.nsf'
database name.
In addition, if you are not putting these database's
in the Domino/data root , the following changes
are required:
XMLReceive.nsf - in the design>
Pages/javascript.js - change the following line
to point to the data store location:
var db="Contacts.nsf"
(ie var db="thisfolder/files/Contacts.nsf")
Do the same in the standalone "javascript.js"
file.
Using the Demonstration
The demonstration basically loads up a Contact
form (a very simple one) in the browser, you
can then populate it - press a submit button
and a contact is then added to the Contacts.nsf
database.

Simple enough - especially if you were using
a Notes Form to display/capture the data. However
for this demonstration, the Contact form is
standard HTML generated using Dreamweaver. This
form therefore fully validates using the validator
at W3.org.
The Basic Design
The data for this demonstration is stored with
the Contacts.nsf database. This is very straightforward
with one form and one view - so no need to go
into detail there.
The 'technical stuff' is within the design
of the 'XMLReceive.nsf' database. This comprises
of the following design elements:
- Page - contact_form.htm
- Page - javascript.js
- Form - GLOBAL_XML_POST
- Agent - GLOBAL_XML_RECEIVE
The 'contact_form.htm' page contains the HTML
I created in Dreamweaver which then contains
a reference to the Javascript within the 'javascript.js'
page. Note these have been set as 'Treat page
contents as HTML'.
The GLOBAL_XML_POST form receives the XML created
by the javascript, and then is submitted to
the Domino server. The Form has its 'WebQuerySave'
set to:
@Command([ToolsRunMacro]; "GLOBAL_XML_RECEIVE")
Therefore when received by the server it is
captured and processed using the 'GLOBAL_XML_RECEIVE'
Java Agent. From there the XML is parsed and
a Notes Document is created using the XML instructions.
As usual please feel free to play around and
to use whatever you want within your own applications.
Questions? -
steve.castledine@projectdx.org
|