Yesterday I wrote about how data in web applications can be replicated locally using Notes replication. Replicating the data is the prereq for offline web applications. The next thing is how you access data in Notes and/or Expeditor from your local web applications.
There are different options to do this. In this blog entry I want to describe one option which I think is the most typical and common one for web applications. Again, what I want to show with this prototype is that Notes/Domino is open, state of the art and not proprietary. So I’ve interviewed different experts in this area and the majority of them pointed me to Atom and the Atom Publishing Protocol (APP). For example Lotus Connections provides an Atom API.
As far as I’ve heard the Atom format and protocol are not the most mature technologies yet. It sounds like there are still lots of issues around collections and their sort orders, handling of multiple attachments, etc. And as soon as you use more than just the standard you need to add your own tags/schema. Many people consider these issues only point in time issues that will be fixed. Without going in more detail, I’m not saying Atom is the best technology on earth, but it is the mostly used technology to do remote calls to read and write data for web applications today. I think the reason for this success is exactly the simplicity.
Because of these issues it might be difficult for Notes/Domino to provide all services as Atom feeds out of the box very soon. However for custom applications there are different ways you can build services that return feeds to web applications.
For many people maybe the simplest mechanism is just to use a Notes agent. Let’s take this simple sample feed that I took from Lotus Mashups. A Lotus Notes agent can very easily return this as a feed. The key is to do a ‘Print “Content-type:text/xml”‘ so that the agent doesn’t add the HTML headers. Here is the agent sample code. The agent uses an URLclass that I’ve found in the internet (sounds like Karl-Henry Martinsson implemented it). If you want to run a local agent the nhttp.exe needs to run as described yesterday.
As an alternative you can also implement services that return feeds as Java servlets running in Lotus Expeditor/Notes. When launching Notes you need to enter these VM arguments to launch the local web container. -Dcom.ibm.pvc.webcontainer.port=8778. I think someone told me that it should be enabled by default but I haven’t tried this.
In the Eclipse IDE you can create a plugin with such a plugin.xml. You can then simply use a standard servlet. This servlet could talk back to NSFs via the notes.jar. If you want you can also use Apache Abdera to get convenience functionality to handle Atom. I like Abdera and would like to have this for LotusScript as well.
On the consumer side (in your web application) you can use your JavaScript library of choice. I’ve used DoJo. However I couldn’t find a simple way to call feeds with DoJo that would work for both IE and Firefox. So I’ve implemented a convenience JavaScript file that abstract this. In my HTML file I can then easily navigate through the feed.