GG.
GG.

Reputation: 21874

Lotus Domino Designer: AJAX or some other way to open a URL to retrieve a data

Following Lotus Domino Designer: Add a button in the default calendar

The link is actually a SSO link (single sign-on) which is delivered by our API to connect the user to our application.

We must execute the url http://example.com/api.asp?cas=GETUSERTOKEN&rdn=9428521&login=mike&logincnx=adminAPIHays&pwdcnx=app

which returns the time-limited SSO link http://example.com/hays/array.asp?key=750EA68A476C9F8D26F9704B203205FDF64D2B849B688F169B398D217FFF570F54C1CB6B4635A494E504E624EDF3266D0D5C2A1210AA43EE3CD2098AE8B42DBF which connects the user.

By what means I can program this in Domino Designer?

If necessary we can put the button in a new something (not necessarily in the default calendar in fact).

Upvotes: 1

Views: 1147

Answers (2)

GG.
GG.

Reputation: 21874

I did this in LotusScript:

Sub Click(Source As Button)
    Dim objHttp As Variant
    Dim url As String
    Dim response As String

    Set objHttp = CreateObject("Microsoft.XMLHTTP")

    url = "http://foo.com/api.asp?cas=GETUSERTOKEN&rdn=9428521&login=mike&logincnx=adminAPIHays&pwdcnx=app"

    objHttp.open "GET", url, False
    objHttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded"

    objHttp.send

    newUrl = objHttp.responseText

    Set w = New NotesUIWorkspace
    w.UrlOpen newUrl
End Sub

Upvotes: 0

angryITguy
angryITguy

Reputation: 9561

Because you want to obtain another URL from an initial URL request, you will need to use a java agent to open a URL connection, and process the response to determine. The best approach is to use the J2SE URLConnection class. Once you're in a java agent, you can capture responses and store them in Documents.

If you need to do something in the UI after receiving the response, then you'll need to call the Java Agent from within a LotusScript function either from the view action or a form button. But if this is not required, you can also call the Java agent directly in view actions and form buttons. Java Agents have no UI output apart from the Java Debug Console. In Domino circles, Bob Balaban is a guru and has recently started to revise his Java in Domino writings. It provides a good insight into how it "hangs together" with the Domino API.

There are numerous examples scattered across the internet about using Java in Domino. IBM has published information on Java Agents in Domino. Some good examples can be found here, here, and here. The latest version of Domino Designer runs under Eclipse, so this may be of help to.

Upvotes: 2

Related Questions