Thanks for your reply & tips to NewComers on this forum.
My WebQueryOpen agent code is:
%REM
Agent VerifyUser
Created Feb 5, 2018 by Kingsley E Fernandes-1/India/IBM
Description: Comments for Agent
%END REM
Option Public
Option Declare
Use "BluePages"
Sub Initialize
On Error GoTo ErrHandle
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim coll As BPResults
Dim bpd As BluePages
Dim curUser As NotesName
Dim dbProfileView As NotesView
Dim dbProfileDoc As NotesDocument
Dim http As Variant
Dim userEmail As String
Dim objHttp As Variant
Dim url As String
Dim req As Variant
Dim webDoc As NotesDocument
Dim rtItem As NotesRichTextItem
Set doc = s.Documentcontext
Set db = s.Currentdatabase
Set dbProfileView = db.Getview("Database Profile")
Set dbProfileDoc = dbProfileView.Getfirstdocument()
Set bpd = New BluePages(dbProfileDoc.APILocator(0)) 'which is the same as = New BluePages("
http://bluepages.ibm.com/BpHttpApisv3/apilocator")
If Not bpd.IsOpen() Or bpd.GetReturnCode() <> 0 Then
MessageBox "Error in connecting to BluePages API",, "Error"
Exit Sub
Else
MessageBox "Connected to BluePages API"
End If
Set curUser = New NotesName(doc.Remote_User(0))
MsgBox "In WQO agent: User logged in is " + doc.Remote_User(0) + " Abbv Name = " & curUser.Abbreviated
'Set coll = bpd.GetPersonByCnum("03350M")
Set coll = bpd.GetPersonsByNotesID(curUser.Abbreviated)
'Set coll = bpd.GetPersonsByNotesID("John O'Brien/Somers/Contr/IBM")
If coll.succeeded() Then
MsgBox "BP message = " & coll.GetErrorMessage() & " code = " & coll.GetReturnCode() 'If the query completed normally,
If coll.rows() = 0 Then 'No records found
Msgbox curUser.Abbreviated & " was not found." & coll.GetColumn("name")
ElseIf coll.rows() >= 1 Then ' coll.rows()>=1 ...and found at least one name,
Msgbox "Name: " & coll.GetColumn("name") & " EMAIL = " & coll.GetColumn("INTERNET")(0)
End if
End If
userEmail = coll.GetColumn("INTERNET")
'userEmail = "kingsfern@in.ibm.com"
MsgBox "To verify " & userEmail & " in ICA BlueGroups"
url = "
https://tstbluepages.mkm.can.ibm.com/tools/groups/groupsxml.wss?task=inAGroup&email=" & userEmail & "&group=ICADEV"
Set objHttp = CreateObject("MSXML2.ServerXMLHTTP")
objHttp.open "POST", url, False
objHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objHttp.send req
MsgBox objHttp.responseText
If InStr( objHttp.responseText, "<rc>0</rc>") <> 0 Then
MsgBox "User is a Member of ICADEV BlueGroups"
Else
MsgBox "User is NOT a Member of ICADEV BlueGroups"
End If
Exit Sub
ErrHandle:
MsgBox "WQO agent error on line = " & Erl & " with msg = " & Error$
End Sub
The output in the Logs are:
02/14/2018 02:07:14 AM Agent message: Connected to BluePages API
02/14/2018 02:07:14 AM Agent message: In WQO agent: User logged in is CN=Kingsley E Fernandes-1/OU=India/O=IBM Abbv Name = Kingsley E Fernandes-1/India/IBM
02/14/2018 02:07:14 AM WEB(2): Loading additional WEB task
02/14/2018 02:07:14 AM WEB(3): Initializing
02/14/2018 02:07:15 AM Agent message: BP message = Success code = 0
02/14/2018 02:07:15 AM Agent message: Kingsley E Fernandes-1/India/IBM was not found.
02/14/2018 02:07:15 AM Agent message: To verify in ICA BlueGroups
02/14/2018 02:07:15 AM Agent message: WQO agent error on line = 77 with msg = Operation not supported on this platform
02/14/2018 02:07:15 AM Agent 'VerifyUser' error: No RESUME
Above shows that even though it has connected to BluePages, the subsequent call says the user is not found which is Incorrect.
Some related BluePages scriptlibrary code:
Class BluePages
Private webDb As NotesDatabase ' The local client's Web Retriever database.
Private webDBOpen As Integer ' Set to true if Web Retriever opens.
Private locatorURL As String ' URL for accessing API Locator, for API dictionary.
Private urlList List As String ' A dictionary of URLs, keyed by command names.
Private listInPlace As Integer ' Flag to determine if API dictionary is loaded.
Private statusCode As Integer ' Integer code to indicate the status.
Private errorMessage As String ' Error message (if any) to indicate the status.
'
' Constructs a new BluePages object with the specified URL for the Web Server
' API Locator. Opens the Notes Web Navigator to be used to retrieve outputs
' from URLs.
'
Sub New(locatorURL As String)
' Default API Locator:
'
'
http://tstbluepages.mkm.can.ibm.com/BpHttpApisv3/apilocator
'
Me.locatorURL = locatorURL
Me.listInPlace = False
Set Me.webDb = New NotesDatabase("", "")
If Not Me.webDb.OpenURLDb Then
' On Notes client, false if Open/Retrieve Pages is "from
' Notes workstation" and Web Navigator Database is
' blank or if Open/Retrieve Pages is "no retrievals" and
' Web Navigator Database is blank or nonexistent..
' Messagebox "Error: Configuration for Web Navigator is incorrect", , "BluePages Script Library"
Me.statusCode = 1
Me.errorMessage = "Unexpected error occurred due to invalid Web Navigator configuration."
Me.webDBOpen = False
Else
Me.statusCode = 0
Me.errorMessage = ""
Me.webDBOpen = True
End If
End Sub
Function GetPersonsByNotesID(template As String) As BPResults
Set GetPersonsByNotesID = GetBPResults("ALLBYNOTESID", template & "%")
End Function
' Returns a BPResults object representing the result table constucted based on
' the results to be retrieved for the specified Web Server API query function
' (opName) and the query string (opArg).
'
Private Function GetBPResults(opName As String, opArg As String) As BPResults
Dim bpe As BPEnumerator
If Me.IsOpen() Then
opArg = Trim$(opArg)
' If argument is missing, warn..
If opArg ="" Or opArg = "%" Then
Set bpe = Me.GetFailedBPEnumerator(opName & " requires a string argument.")
Elseif opArg = "+" Then
Set bpe = Me.GetFailedBPEnumerator(opName & " requires two string arguments.")
Else
' If argument is present, fetch data from BluePages..
' Is the API dictionary is loaded?
If Me.URLListReady() Then
' Does the specified query function exist?
If Iselement(Me.urlList(opName)) Then
Set bpe = Me.GetBPEnumerator(Me.urlList(opName) & URLEncode(opArg))
Else
' The specified query function does not exist..
Set bpe = Me.GetFailedBPEnumerator("Command: " & opName & " not found in the API dictionary.")
End If
Else
' The API dictionary is not loaded..
Set bpe = Me.GetFailedBPEnumerator("The API locator function failed to load the API dictionary.")
End If
End If
Else
Set bpe = Me.GetFailedBPEnumerator("Cannot complete the request due to invalid Web Navigator configuration.")
End If
Set GetBPResults = New BPResults(bpe)
End Function
So the first problem is that it does not fetch the user from getPersonsByNotesID which triggers the log messages: "WEB(2): Loading additional WEB task & WEB(3): Initializing" and the second problem is that I cannot use CreateObject("MSXML2.ServerXMLHTTP") which triggers the log message: Operation not supported on this platform.
Please advise for a workaround. Thank.