dominoGuru.com

Your Development & Design Resource

YellowCake 2.0: RESTful MVC Web Services for IBM Lotus Notes Domino Apps

YellowCake 2.0: RESTful MVC Web Services for IBM Lotus Notes Domino Apps

Now that we have RESTful Web Services that we can run with to support IBM Lotus Notes Domino Application NotesData CRUD (Create, Read, Update, Delete)... we might as well push the envelope and create a complete MVC (Model-View-Controller) proxy!

I recently found a need for YellowCake - my never-released (in version 1.0) NotesData CRUD proxy - so I thought it would be an excellent time to put some serious development effort into YellowCake 2.0. This recent need was a multi-developer effort to create a series of Mobile Device Clients for the IBM Lotus Product Wikis. The original intention was simply to add integration hooks into the new IBM Lotus Notes Domino XPage-based Wiki Template. Fairly straight forward really: you need to add additional functionality to an application in Lotus Notes Domino, you crack open Domino Designer.

Upon further discussion however, the idea that we didn't want to have to modify the target NotesDatabase Applications gained attention. See, with the crack open Domino Designer approach with any IBM supported Template - such as the Mail Template (or in this case the XPage Wiki Template) - you are creating that potential maintenance nightmare... or at the very least an individual one-off via your customization.

And sure, there are plenty of ways to work around that from a Design Element inheritance architecture... but once you modify a released Template upgrades are either a chore or simply can't be done.

Enter the idea for a NotesData CRUD Proxy! Instead of modifying the target NotesDatabase (or the NotesDatabase design/Template), you're going to create a custom API via -- in this case -- an XPage XAgent HTTP Request Consumer that will Create, Read, Update, and Delete NotesData from the target NotesDatabase. At least... that's the idea.

So where does YellowCake, MVC, and REST come into play??

Well, that's where the fun begins!

YellowCake was designed with configuration in mind. You could configure your target NotesDatabase based on a supplied key. You could configure how the NotesData was returned to the requesting client. You could configure the NotesData which was posted to given NotesItems. You could control -- via this configuration -- the NotesData Model, the rendered View, and the business logic Controller. Epic Win!

The major PITA quite frankly was the need to define every interaction via key. Now that I've found a way to support RESTful Web Services via XPages though... that won't be a problem!

... see, let's say I call the following YellowCake URL via the GET Method:

http://server/yellowcake.nsf/api?open&key=abc123&uid=def567&action =GET

Same functionality as before: I would run the equivalent of an @DBLookup to the NotesDatabase defined within the Application Profile for the key abc123, grabbing the NotesDocument def567. The action segment of the QueryString would denote the GET Method. Sure, for reading/returning NotesData or even Creating/Updating NotesData... this was a no-brainer and didn't require the action parameter, but what about Deletes?

With the advent of RESTful Web Services, I can now pull the intended action from the Method and perform my action based on that...

So now my URL would look like this:

http://server/yellowcake.nsf/api?open&key=abc123&uid=def567

The Method Verb - GET, POST, PUT, or DELETE - on the above URL would be captured by the listener XPage XAgent and look to the business logic defined in the configuration-based Controller to do... well, whatever it is you told it to do.

See, not relying on the target NotesDatabase (which could reside on a non-HTTP-accessible Domino Server since we're communicating via NRPC) to render or perform the function intended allows us to completely change how we create IBM Lotus Notes Domino Applications. You'll no longer need Views in your NotesDatabases, as the rendered NotesData is processed and cached via XPage and SSJS. You'll no longer use clunky WebQuerySave events to fire off NotesData-based workflow, as only the NotesData you need will be written back to the target NotesDocument!

OK - there's a lot more to cover here, and I can feel myself babbling on and not making much sense unless you could see an example of what I'm getting at... so I think that's the next step:

I will be moving forward with a Proof of Concept for a RESTful Web Services implementation of MVC NotesData Proxy for IBM Lotus Notes Domino Web Applications.

In other words, I'll be working on YellowCake 2.0! ;-)


About the author: Chris Toohey

Thought Leadership, Web & Mobile Application Development, Solutions Integration, Technical Writing & Mentoring

A published developer and webmaster of dominoGuru.com, Chris Toohey specializes in platform application development, solutions integration, and evangelism of platform capabilities and best practices.



More from dominoGuru.com


dominoGuru.com is powered by IBM Notes Domino XPages & hosted by Prominic.NET

Contact Us

Use our Contact / Feedback form or one of these email addresses:

Creative Commons License

Except where otherwise noted, dominoGuru.com by Chris Toohey is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.