dominoGuru.com

Your Development & Design Resource

Simple HTTP Request Consumer - Traditional IBM Lotus Notes Domino

The ability to consume an HTTP Request is a building block for not only HTTP-accessible applications but is critical in 3rd-party integration.

It is also so ridiculously simple that there's absolutely no excuse: it should be used in every one of your IBM Lotus Notes Domino Web Applications.

Recently, I worked on a solution which consisted of my app communicating with a 3rd-party service. That service would report it's success/fail response via HTTP Request to a submitted URL (via the 3rd-party service API). Simply put, I was able to tell service to send a confirmation via HTTP Request to a specific URL.

That URL, since I was using Traditional IBM Lotus Notes Domino Design Elements, pointed to an Agent Design Element.

Since the HTTP Request could contain any information - from successful processing to failed job status to miscellaneous chatter, I wanted to make it as flexible (as well as future-proofed) as possible.

My response.http Agent looked something like this:

%REM
    Agent request.http
    Created Oct 18, 2010 by Chris Toohey
    Description: Comments for Agent
%END REM

Option Public
Option Declare

Sub Initialize()
   
    Dim s As New NotesSession
    Dim doc As NotesDocument
   
    Set doc = s.Currentdatabase.Createdocument()
    Call s.Documentcontext.Copyallitems(doc)
    Call doc.Replaceitemvalue("form", "response")
    Call doc.Save(True, False, False)  
   
End Sub

Pretty simple, huh? I just - literally - consume the HTTP Request via the NotesSession DocumentContext and create a new NotesDocument in the current NotesDatabase.

This technique gives you limitless application -- any communication with the request.http Agent Design Element will result in a response NotesDocument.

This is, of course, using Traditional IBM Lotus Notes Domino Design Elements. My follow-up post will show you how you can achieve the same functionality in an XPages-world!


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.